0

評価しようとしているアプリスクリプトプロジェクトにHTMLテンプレートがあります。サーバーエラーが発生し続けますが(あまり役に立ちません)、デバッグ中に何も見つかりません。getCode()の実行結果を試しましたが、エラーはありませんでした。次に、output。$ out.getContent()(https://developers.google.com/apps-script/html_serviceで説明)を実行しました。これにより、期待されるhtml出力が得られます。

HTMLファイルを添付しますが、多くの変数が含まれているため、エラーのあるリーンバージョンを作成するのに問題があります。私は誰かがこれらのファイルをデバッグするためのより良いまたは正しい方法を知っていることを望んでいます。

編集:とにかくここにファイルがあります、

htmlファイル:

<html>
  <body>
    <form action="https://script.google.com/macros/s/AKfycbxHQDJoAtAjBF9uIctvmxBHv-QVpYf6f15UZf8aAnAh_1U_PzU/exec" method="POST" id="mail-form">
      <table>
        <tr style="background-color: #392303; font-size: large; line-height: 30px;">
          <th>
            <a href="<?= info.profile ?>" style="color: #e06c01; font-weight: lighter;"><?= userForm.userName ?></a>
          </th> 
          <th colspan="3"> 
            <div width="250px" style="color: #e06c01; font-weight: lighter; float: left; text-indent: 10px;"><?= userForm.experience ?></div> 
            <div style="color: #FFFFFF; background-color: <?= userForm.pastColor ?>; border: 1px solid white; width: 28px; height: 28px; float: right;" title="<?= userForm.pastApplications ?>">
              <center><?= userForm.pastNumber ?></center> 
            </div>
          </th> 
        </tr>
        <tr style="background-color: #9c9181"> 
          <td width="100">
            <center><p style="font-size:small; top: 5px; margin-bottom: 3px;">Thanks meter: <?= info.thanks ?></p></center> 
            <center><img alt="" src="" style="margin-bottom: 10px;"/></center> 
            <center><img src="<?= info.avatar ?>" style="height: 60px; margin-bottom: 10px;" /></center> 
            <center><p style="font-size:small; margin-bottom: 3px; margin-top: 3px;">Posts: <?= info.totalPosts ?></p></center> 
            <center><p style="font-size:small; margin-bottom: 3px; margin-top: 3px;">Per day: <?= info.postsPerDay ?></p></center> 
            <center><p style="font-size:small; margin-bottom: 3px; margin-top: 3px;">Join date: <?= info.joinDate ?></p></center> 
            <center><p style="font-size:small; margin-bottom: 3px; margin-top: 3px;">Last activity: <?= info.activity ?></p></center>
          </td> 
          <td>
            <center><?= userForm.onSite ?></center>
          </td> 
          <td>
            <center><?= userForm.tools + '\n' + '\n' + userForm.theHardPart ?></center>
          </td> 
          <td width="100">
            <center><?= userForm.development ?></center>
          </td> 
        </tr>

        <tr style="background-color: #392303; font-size: large; line-height: 30px;">
          <td colspan="4" style="color: #e06c01; font-weight: lighter; text-indent: 10px;">Review</td>
        </tr>

        <tr style="background-color: #9c9181">
          <td colspan="1" valign="top">
            <label><input type="radio" name="review" value="approved" id="review_1">Accept</label>
          </td>
          <td colspan="1" valign="top">
            <label><input type="radio" name="review" value="rejected" id="review_2">Reject</label><br><br>
            <label><b>Reason(s) for user</b></label><br>
            <label><input type="checkbox" name="reason" value="Reason1" id="requirements">Reason1</label><br>
            <label><input type="checkbox" name="reason" value="Reason2" id="requirements">Reason2</label><br>
            <label><input type="checkbox" name="reason" value="Reason3" id="requirements">Reason</label><br>
            <label><input type="checkbox" name="reason" value="Reason4" id="requirements">Reason4</label><br>
            <label><input type="checkbox" name="reason" value="Reason5" id="requirements">Reason5</label><br>
            <label><input type="checkbox" name="reason" value="Reason6" id="requirements">Reason6</label><br>
          </td>
          <td colspan="1" style="text-indent: 3px;">
            <label><b>Feedback</b></label><br>
            <label><i>Rejections:</i> <b>WARNING</b> users will see this</label><br>
            <label><i>Approvals:</i> only for us</label><br>
            <textarea name="comments" rows="10" cols="35" id="comments"></textarea>
          </td>
        </tr>        
      </table>

      <input type="hidden" name="userName" id="userName" value="<?= userForm.userName ?>"/>
      <input type="hidden" name="reviewerName" id="reviewerName" value="<?= userForm.reviewer ?>"/>
      <input type="hidden" name="link" id="link" value="<?= info.profile ?>"/>
      <input type="hidden" name="row" id="row" value="<?= userForm.row ?>"/>
      <input type="hidden" name="hash" id="hash" value="<?= userForm.hash ?>"/>

      <div>
        <div style="float: left;">
          <input type="submit" name="submit" id="submit" value="Submit">
        </div>
        <div style="float: right;">
          <a href="mailto:<?= mailTo ?>?subject=<?= subject ?>&body=<?= body ?>"> 
            <b>Consult</b>
          </a>
        </div>
      </div>

    </form>
  </body>
</html>

スクリプトの関連部分:

  var htmlTemplate = HtmlService.createTemplateFromFile('DC Form');
  htmlTemplate.userForm = userForm;
  htmlTemplate.info = info;
  htmlTemplate.mailTo = mailTo;
  htmlTemplate.subject = 'CONSULT: ' + userForm.userName;
  htmlTemplate.body = 'Profile link: ' + userForm.profile + '\n' + '\n';
  var code = htmlTemplate.getCode();
  Logger.log(code);
  var html = htmlTemplate.evaluate().getContent();

何でもいただければ幸いです、

M.オラニエ

編集:

Caja Playgroundを使用した後、次の行にエラーが見つかりました。

<div style="color: #FFFFFF; background-color: <?= userForm.pastColor ?>; border: 1px solid white; width: 28px; height: 28px; float: right;" title="<?= userForm.pastApplications ?>">

属性内でのスクリプトレットの使用がサポートされていない可能性がありますか?

4

2 に答える 2

0

Well then, it looks like a simple missing of 'px' in the width attribute was the cause of all this trouble.

<td width="100">

It is fairly hard to locate as the error only appeared in certain conditions, probably only when that the size didn't match whatever it was. This would be why Corey G. though it had to be the variables, as the variables had to be of a certain length to trigger that width error. Headaches gone.

于 2012-09-12T00:19:31.380 に答える
0

あなたのhtmlに触れずに、.gsファイルのこのわずかな変形を試しました:

function doGet() {
  var htmlTemplate = HtmlService.createTemplateFromFile('DC Form');
  var userForm = {userName: 'userName', profile: 'profile'};
  htmlTemplate.userForm = userForm;
  htmlTemplate.info = "info";
  htmlTemplate.mailTo = "mailTo";
  htmlTemplate.subject = 'CONSULT: ' + userForm.userName;
  htmlTemplate.body = 'Profile link: ' + userForm.profile + '\n' + '\n';
  var code = htmlTemplate.getCode();
  Logger.log(code);
  return htmlTemplate.evaluate();
}

これは私にとってはうまくいきます。変数の値の 1 つに問題があると思われます。

于 2012-09-07T20:59:01.250 に答える