I have created ASP page, which looks like:
I need something like this center image:
I tried to set background for header, it works fine. However, I am not able to set for next button.
Here is my code snippet:
$(document).ready(function() {
// CREATE A "DIV" ELEMENT AND DESIGN IT USING JQUERY ".css()" CLASS.
var container = $(document.createElement('div')).css({
padding: '5px', margin: '20px', width: '170px'});
$(container).append('<input type=text class="input" id="tb1" value="Text Element 1" />');
$(container).append('<input type=text class="input" id="tb2" value="Text Element 2" />');
$(container).append('<input type=text class="input" id="tb3" value="Text Element 3" />');
$(container).append('<input type=text class="input" id="tb4" value="Text Element 4" />');
$('#main').after(container); // ADD BOTH THE DIV ELEMENTS TO THE "main" CONTAINER.
var iCnt = 4;
$('#btAdd').click(function() {
if (iCnt <= 19) {
iCnt = iCnt + 1;
// ADD TEXTBOX.
$(container).append('<input type=text class="input" id=tb' + iCnt + ' ' +
'value="Text Element ' + iCnt + '" />');
$('#main').after(container); // ADD BOTH THE DIV ELEMENTS TO THE "main" CONTAINER.
}
else { // AFTER REACHING THE SPECIFIED LIMIT, DISABLE THE "ADD" BUTTON. (20 IS THE LIMIT WE HAVE SET)
$(container).append('<label>Reached the limit</label>');
$('#btAdd').attr('class', 'bt-disable');
$('#btAdd').attr('disabled', 'disabled');
}
});
$('#btRemove').click(function() { // REMOVE ELEMENTS ONE PER CLICK.
if (iCnt != 0) { $('#tb' + iCnt).remove(); iCnt = iCnt - 1; }
if (iCnt == 0) { $(container).empty();
$(container).remove();
$('#btSubmit').remove();
$('#btAdd').removeAttr('disabled');
$('#btAdd').attr('class', 'bt')
}
});
$('#btRemoveAll').click(function() { // REMOVE ALL THE ELEMENTS IN THE CONTAINER.
$(container).empty();
$(container).remove();
$('#btSubmit').remove(); iCnt = 0;
$('#btAdd').removeAttr('disabled');
$('#btAdd').attr('class', 'bt');
});
});
// PICK THE VALUES FROM EACH TEXTBOX WHEN "SUBMIT" BUTTON IS CLICKED.
var divValue, values = '';
function GetTextValue() {
$(divValue).empty();
$(divValue).remove(); values = '';
$('.input').each(function() {
divValue = $(document.createElement('div')).css({
padding:'5px', width:'200px'
});
values += this.value + ','
});
$(divValue).append('<p><b>Your selected values</b></p>' + values);
$('body').append(divValue);
}
#tbl-two-columns td.invitation-col2
{
padding-left:0px !important;
}
.cs_pendingInvitation img
{
margin-top:3px;
}
// styles for invite more friends -- selva
.invitation-header
{
background: none repeat scroll 0% 0% #C2EBFF;
z-index: 99;
}
#btAdd
{
color: #00BFFF;
}
#main a{
text-decoration:none;
}
input#nextbutton {
padding: 5px 15px;
background: none repeat scroll 0% 0% #00BFFF;
color: #FFF;
border: 0px none;
cursor: pointer;
border-radius: 5px;
}
.input {
color: #333;
height: 25px;
margin: 5px;
width: 380px;
}
<table class="tblmain atep" style="width: 450px;" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td class="tdbodycontent" align="left">
<table class="wrapper" style="width:450px;margin:0 auto;" cellpadding="0" cellspacing="0">
<tbody><tr>
<td class="tdcontainer" align="left">
<table style="width:450px;" id="tbl-two-columns" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<th class="invitation-header" valign="top"> <!-- th added for invite header --selva -->
Help make your neighborhood safer, Invite friends and family
</th> <!-- END - th added for invite header --selva -->
</tr>
<tr>
<td class="invitation-col2" valign="top">
<table id="tab1" class="tab-container" style="width:400px;" cellpadding="0" cellspacing="0">
<tbody><tr>
<td valign="top">
<form method="post" name="form1" action="invitation_enrollv5.asp?action=1" onsubmit="return GetTextValue()">
<!--START - Invite Buttons - Selvarani-->
<div style="padding: 5px; margin: 0px;"><input class="input" id="tb1" placeholder="Email" type="text"><input class="input" id="tb2" placeholder="Email" type="text"><input class="input" id="tb3" placeholder="Email" type="text"><input class="input" id="tb4" placeholder="Email" type="text"></div><div id="main"><a style="float: right;" href="#" id="btAdd" value="" class="bt">Invite more friends</a></div><table style="margin: 0px auto 10px; width: 350px;" border="0" cellpadding="0" cellspacing="0">
<input id="contact_list" name="contact_list" value="" type="hidden">
<!--END - Invite Buttons - Selvarani-->
</table>
<p style="">Invite from my address book</p>
<img src="Web5/images/invite-your-contacts.png" style="cursor:pointer;" alt="Invite your contacts" onclick="InviteBoxClick();"><br>
<a href="#cs_container" data-cs-init="true" class="cs_import">
</a>
<input name="cnote" value="" type="hidden">
<input name="pkfamilyinvite" value="0" type="hidden">
<input name="vn" value="0" type="hidden">
<input name="gORn" value="1" type="hidden"><br>
<input style="float: right;" id="nextbutton" name="" value="Next" type="submit"> <!-- id="nextbutton" added for button styles -- selva -->
</form>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td class="tdfooter" align="left">
<div class="wrapper">
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
Replace this input#nextbutton { with #nextbutton {
Related
I have multiple input datalist that will populate based on the input or selection in the previous datalist. It uses the jQuery load event to call a page with VBscript to pull the data from a SQL Server DB. Everything works fine until an input is enter that has spaces between the words, then the options are not loaded in the datalist.
I have tried using the encodeURIComponent(), but that does not resolve the issue. The call to the VBscript page seems to work fine in all cases. I have done the same thing with linked select tags and they work fine. The spaces seem to be the issue. Thanks in advance for the help.
Below is the code I am using.
JQuery Code:
$().ready(function() {
// Ajax code to get data to populate Group dropdown selection from Site selection
$("#Site").change(function() {
$("#Groups").load("scp_getListData.asp?WS=13&LV=1&ST=" + $("#Site").val());
});
// Ajax code to get data to populate Menu Name dropdown selection from Site & Group selection
$("#Group").change(function() {
$("#MenuNames").load("scp_getListData.asp?WS=13&LV=2&ST=" + $("#Site").val() + "&GP=" + $("#Group").val());
$('#MenuNamesLabel').text(event.target.id + " was changed?WS=13&LV=2&ST=" + $("#Site").val() + "&GP=" + $("#Group").val());
});
// Ajax code to get data to populate Level 1 Menu dropdown selection from Site, Group, Name selection
$("#MenuName").change(function() {
$("#Menu1Ops").load("scp_getListData.asp?WS=13&LV=3&ST=" + $("#Site").val() + "&GP=" + $("#Group").val() + "&MN=" + $("#MenuName").val());
$('#Menu1OpsLabel').text(event.target.id + " was changed?WS=13&LV=3&ST=" + $("#Site").val() + "&GP=" + $("#Group").val() + "&MN=" + $("#MenuName").val());
});
// Ajax code to get data to populate Level 3 Menu dropdown selection from Site, Group, Name, Level 1 selection
$("#Menu_1").change(function() {
$("#Menu2Ops").load("scp_getListData.asp?WS=13&LV=4&ST=" + $("#Site").val() + "&GP=" + $("#Group").val() + "&MN=" + $("#MenuName").val() + "&ML1=" + $("#Menu_1").val());
});
// Ajax code to get data to populate Level 1 Menu dropdown selection from Site, Group, Name, Level 1, Level 2 selection
$("#Menu_2").change(function() {
$("#Menu3Ops").load("scp_getListData.asp?WS=13&LV=5&ST=" + $("#Site").val() + "&GP=" + $("#Group").val() + "&MN=" + $("#MenuName").val() + "&ML1=" + $("#Menu_1").val() + "&ML2=" + $("#Menu_2").val());
});
});
HTML Code:
<form action="test_process.asp" class="valerror" name="MyForm" id="MyForm" method="post">
<table class="normal box" style="width: 750px; text-align:center" cellspacing="1" cellpadding="0" border="0">
<tr>
<td class="form_descr" style="width: 20%;">
<label for="Site">Site</label>
</td>
<td class="medium" style="text-align: left; padding: 3px 0px 3px 5px">
<select size="1" name="Site" id="Site" class="form_req" tabindex="1" required data-msg-required="The Site Field is Required!" onKeyDown="return tabCR(this,event);">
<option value="" selected="selected">Please Select</option>
</select>
</td>
</tr>
<tr>
<td class="form_descr" style="width: 20%;">
<label for="Group">Group Or Cell</label>
</td>
<td class="medium" style="text-align: left; padding: 3px 0px 3px 5px">
<input name="Group" id="Group" list="Groups" size="20" maxlength="20" class="form_req" tabindex="2" type="text" required data-msg-required="The Group Field is Required!" onKeyDown="return tabCR(this,event);">
<datalist id="Groups">
</datalist>
</td>
</tr>
<tr>
<td class="form_descr" style="width: 20%;">
<label for="MenuName">Menu Name</label>
</td>
<td class="medium" id="Email2" style="text-align: left; padding: 3px 0px 3px 5px;">
<input name="MenuName" id="MenuName" list="MenuNames" size="50" maxlength="50" class="form_req" tabindex="3" type="text" required data-msg-required="The Menu Name Field is Required!" onKeyDown="return tabCR(this,event);">
<datalist id="MenuNames">
</datalist>
<span id="MenuNamesLabel"></span>
</td>
</tr>
<tr>
<td class="form_descr" style="width: 20%;">
<label for="Menu_1">Level 1 Menu</label>
</td>
<td class="medium" style="text-align: left; padding: 3px 0px 3px 5px">
<input name="Menu_1" id="Menu_1" list="Menu1Ops" size="85" maxlength="150" class="form_req" tabindex="4" type="text" required data-msg-required="The Level 1 Menu Field is Required!" onKeyDown="return tabCR(this,event);">
<datalist id="Menu1Ops">
</datalist>
<span id="Menu1OpsLabel"></span>
</td>
</tr>
<tr>
<td class="form_descr" style="width: 20%;">
<label for="Menu_2">Level 2 Menu</label>
</td>
<td class="medium" style="text-align: left; padding: 3px 0px 3px 5px">
<input name="Menu_2" id="Menu_2" list="Menu2Ops" size="85" maxlength="150" class="form_fields" tabindex="5" type="text" onKeyDown="return tabCR(this,event);">
<datalist id="Menu2Ops">
</datalist>
</td>
</tr>
<tr>
<td class="form_descr" style="width: 20%;">
<label for="Menu_3">Level 3 Menu</label>
</td>
<td class="medium" style="text-align: left; padding: 3px 0px 3px 5px">
<input name="Menu_3" id="Menu_3" list="Menu3Ops" size="85" maxlength="150" class="form_fields" tabindex="6" type="text" onKeyDown="return tabCR(this,event);">
<datalist id="Menu3Ops">
</datalist>
</td>
</tr>
</table>
</form>
How can i move to the next page after clicking onthe submit button, in my case my submit button is not working. I used some JQuery code inside this html page, is that a reason?
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<form action="form_table_output.html" name="myform" method="post" style="width: 1200px; margin:0px auto">
<h1 title="Cycle calculation"> Cycle Time Calculation INSIGNUM </h1>
<hr><br>
<table border="0" cellpadding="18" cellspacing="10" style="margin:0px 40px;">
<tr>
<td style="width: 50%">
<label for="to_check_recognition"><b>Do you have to check Orientation? <span style="color:red">*</span></b></label><br><br>
<select id="to_check_recognition" name="to_check_recognition" style="width: 350px; height: 35px; border-radius: 8px" required>
<option value="" disabled selected > Please Select... </option>
<option value="yes"> Yes</option>
<option value="no"> No </option>
</select><br><br>
</td>
<td style="width: 50%">
<div id = "Average_orientation" style="display: none;">
<label for="Average_orientation"><b>Average amount of orientation check per panel <span style="color:red">*</span></b></label><br><br>
<input type = "number" step="any" name = "Average_orientation" style="width: 350px; height: 25px; border-radius: 8px" required /><br><br>
</td>
</tr>
<script>
$(document).ready(function() {
Orientation();
$("#to_check_recognition").change(function() {
Orientation();
});
});
function Orientation() {
if ($("#to_check_recognition").val() == 'yes')
$("#Average_orientation").show();
else
$("#Average_orientation").hide();
}
</script>
<tr>
<td colspan="2" style="text-align: right; height: 225px">
<input name="submit" type="submit" value="Click To Submit" style="width: 200px; height: 50px; border-radius: 12px; color: blue; background: gold; cursor: pointer;" />
</td>
</tr>
</table>
</form>
</body>
</html>
You have given required attribute to input:
<input type = "number" step="any" name = "Average_orientation" style="width: 350px; height: 25px; border-radius: 8px" required />
When you select no & input is hidden, due to required attribute, form is not submitted.
Change value of input to 0 then submit form:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<form action="form_table_output.html" name="myform" method="post" style="width: 1200px; margin:0px auto">
<h1 title="Cycle calculation"> Cycle Time Calculation INSIGNUM </h1>
<hr><br>
<table border="0" cellpadding="18" cellspacing="10" style="margin:0px 40px;">
<tr>
<td style="width: 50%">
<label for="to_check_recognition"><b>Do you have to check Orientation? <span style="color:red">*</span></b></label><br><br>
<select id="to_check_recognition" name="to_check_recognition" style="width: 350px; height: 35px; border-radius: 8px" required>
<option value="" disabled selected > Please Select... </option>
<option value="yes"> Yes</option>
<option value="no"> No </option>
</select><br><br>
</td>
<td style="width: 50%">
<div id = "Average_orientation" style="display: none;">
<label for="Average_orientation"><b>Average amount of orientation check per panel <span style="color:red">*</span></b></label><br><br>
<input type = "number" step="any" name = "Average_orientation" style="width: 350px; height: 25px; border-radius: 8px" required /><br><br>
</td>
</tr>
<script>
$(document).ready(function() {
Orientation();
$("#to_check_recognition").change(function() {
Orientation();
});
});
function Orientation() {
if($("#to_check_recognition").val() == 'yes'){
$("#Average_orientation").show();$("input[name=Average_orientation]").val("");}else if($("#to_check_recognition").val() == 'no'){
$("#Average_orientation"). hide();$("input[name=Average_orientation]").val("0"); }
}
</script>
<tr>
<td colspan="2" style="text-align: right; height: 225px">
<input name="submit" type="submit" value="Click To Submit" style="width: 200px; height: 50px; border-radius: 12px; color: blue; background: gold; cursor: pointer;" />
</td>
</tr>
</table>
</form>
</body>
</html>
in my case my submit button is not working
When I am testing your code I am correctly redirecting to "form_table_output.html"
What do you mean, when you click nothing happen or when you click something happen but it is not what you want?
submit button is working fine and correctly redirect to "form_table_output.html".
But the error is a bad path i.e. this is path "form_table_output.html" not exist. So please define it in your codebase.
I have been reading everything but I'm not sure why i can not get the buttons to center under the top image. The .page_wrap margins are both auto?
I am trying to get the buttons to center on a desktop browser and samsung note 3 browser
body {
background-image: url("http://i.imgur.com/KH2LTHz.jpg");
}
.page_wrap {
border:0px solid black;
width:350px;
height:10px;
margin-left:auto;
margin-right:auto;
}
.space {
border:0px solid black;
width:250px;
height:150px;
margin-left:auto;
margin-right:auto;
}
input[type="button"], input[type="submit"], button {
background: none;
background-image: url(http://i.imgur.com/9qwHx0c.png);
background-position: center center;
background-repeat: no-repeat;
border: 0px;
height: 71px;
width: 227px;
font-weight:200;
font-size: 40px;
color: #FFFFFF;
/* add the rest of your attributes here */
}
img.shedremote {
display: block;
margin-left: auto;
margin-right: auto;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheets/shedmine.css" />
<script>
var device = "http://192.168.1.178/";
function reqListener() {
console.log(this.responseText);
}
function setLed(i, state) {
if (state === undefined || state !== 'on') state = 'off';
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
if (i === 'all') {
oReq.open("GET", device + "?all=" + state);
} else {
oReq.open("GET", device + "?led" + i + "=" + state);
}
oReq.send();
}
</script>
</head>
<body>
<div class="space"></div>
<img class="shedremote" src="http://i.imgur.com/wTL0PlY.png" alt="shedremote">
<div class="space"></div>
<div class="page_wrap">
<table style="width:200%">
<tr>
<td> <input type="button" value="Lights on!" onClick="setLed(1,'on')"/> </td>
<td> <input type="button" value="Lights Off!" onClick="setLed(1,'off')"/> </td>
</tr>
<tr>
<td> <input type="button" value="door open" onClick="setLed(2,'on')" /> </td>
<td> <input type="button" value="door locked" onClick="setLed(2,'off')"/> </td>
</tr>
<tr>
<td> <input type="button" value="3 on" onClick="setLed(3,'on')" /> </td>
<td> <input type="button" value="3 off" onClick="setLed(3,'off')" /> </td>
</tr>
<tr>
<td> <input type="button" value="Disco on" onClick="setLed(4,'on')" /> </td>
<td> <input type="button" value="Disco off" onClick="setLed(4,'off')" /> </td>
</tr>
<tr>
<td> <input type="button" value="5 on" onClick="setLed(5,'on')" /> </td>
<td> <input type="button" value="5 off" onClick="setLed(5,'off')" /> </td>
</tr>
<tr>
<td> <input type="button" value="6 on" onClick="setLed(6,'on')" /> </td>
<td> <input type="button" value="6 off" onClick="setLed(6,'off')" /> </td>
</tr>
<tr>
<td> <input type="button" value="7 on" onClick="setLed(7,'on')" /> </td>
<td> <input type="button" value="7 off" onClick="setLed(7,'off')" /> </td>
</tr>
<tr>
<td> <input type="button" value="8 on" onClick="setLed(8,'on')" /> </td>
<td> <input type="button" value="8 off" onClick="setLed(8,'off')" /> </td>
</tr>
</table>
</div>
</body>
</html>
To horizontally center the div itself:
/* If the div has the class "button-wrapper" */
.button-wrapper {
margin: 0 auto;
}
Or, to horizontally center the buttons within the div:
/* If each button has the class "button-centered" */
.button-centered {
text-align: center;
}
EDIT: I suppose you could keep using tables if you like. However, tables for layout is often not considered "best practice." For example, responsive design becomes more difficult because tables cannot automatically adapt to different screen sizes.
for your desktop problem i would try:
.page_wrap
{
border:0px solid black;
width:500px;
margin: 0 auto;
}
body {
background-image: url("http://i.imgur.com/KH2LTHz.jpg");
width:100%;
}
and remove style from the html document.
another thing you your page is not compatible for Samsung note 3 browser
you can try and work with Media Queries to help fit your page for desktop and smartphone.
.
page is available here: http://macrorevolution.com/calculators/bmr/
How do I go about creating space after my input[text] box. For example, I want to create 1px spacing between the input box and "Years","ft","In"."k/cal per day".
I tried using .ipadding but that didn't work so ignore it. Also, how can I shift all of the input boxes closer to "Age", "Height", "weight"?
I am new to html/css.
<?php
$answer = "";
$agev = "";
$feetv = "";
$inchesv = "";
$weightv = "";
$sex = "";
if(isset($_POST['agev']) && isset($_POST['feetv']) && isset($_POST['inchesv']) && isset($_POST['weightv']) && isset($_POST['sex'])) {
$agev = $_POST['agev'];
$feetv = $_POST['feetv'];
$inchesv = $_POST['inchesv'];
$weightv = $_POST['weightv'];
$sex = $_POST['sex'];
$totalheightv = $inchesv + ($feetv*12);
$heightcm = $totalheightv*2.54;
$weightkg = $weightv/2.2;
if($sex=='male') $answer = round((66.47 + (13.75*$weightkg) + (5*$heightcm) - (6.75*$agev)),0);
if($sex=='female') $answer = round((665.09 + (9.56*$weightkg) + (1.84*$heightcm) - (4.67*$agev)),0);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<title>Basal Metabolic Rate Calculator</title>
<style>
table {
border: 30px;
font-size:13px;
font-family: 'PT Sans', sans-serif;
background-color:#FFFFFF;
}
tr.spaceUnder > td
{
padding:0em 1em 1em 0em;
}
p.ss {
font-size:30px;
}
.ipadding {
padding:1px;
}
</style>
</head>
<body>
<div class="box pt20">
<p class="ss">MacroRevolution BMR Calculator</p><br>
<table width='80%' style="margin: 0 auto;">
<tr class="spaceUnder">
<td colspan="4">
BMR = Basal Metabolic Rate (similar to RMR = Resting Metabolic Rate). Your BMR represents the number of calories your body burns at rest. Regular routine of cardiovascular exercise can increase your BMR, improving your health and fitness when your body's ability to burn energy gradually slows down.
</td>
</tr>
</table>
<form method='post' action=''>
<table width='80%' style="margin: 0 auto;">
<tr class="spaceUnder">
<td>Age:</td>
<td><input type='text' name='agev' value="<?php echo $agev; ?>"/>Years</td>
</tr>
<tr class="spaceUnder">
<td>Height:</td>
<td align="justify"><input type='text' name='feetv' value="<?php echo $feetv; ?>"/>Ft<p> </p>
<input type='text' name='inchesv' value="<?php echo $inchesv; ?>"/>In</td>
</tr>
<tr class="spaceUnder">
<td>Weight:</td>
<td align="left"><input type='text' name='weightv' value="<?php echo $weightv; ?>"/>lbs</td>
</tr>
<tr class="spaceUnder">
<td colspan="2"><input type='radio' name='sex' value='male'>Male
<input type='radio' name='sex' value='female'>Female</td>
</tr>
<tr class="spaceUnder">
<td colspan="2"><input type='submit' class="button highlight small" value='Calculate'/></td>
</tr>
<tr class="spaceUnder">
<td colspan="2">Your BMR is <input type='text' style="width: 50px;" value='<?php echo $answer?>' />k/cal per day </td>
</tr>
</table>
</form>
<table border='0' width='80%' style="margin: 0 auto;">
<td colspan="4">
Formula for BMR
If you want to manually calculate your BMR, use the (Harris-Benedict formula) <br> below. <br><br>
Men: BMR=66.47+ (13.75 x W) + (5.0 x H) - (6.75 x A) <br>
Women: BMR=665.09 + (9.56 x W) + (1.84 x H) - (4.67 x A) <br><br>
W = Weight in kilograms (lbs/2.2)<br>
H = Height in centimeters (inches x 2.54)<br>
A = Age in years <br><br><br>
</td>
</table>
</div>
</body>
</html>
put a margn on the right side.
input {
margin-right:5px;
}
So many ways, one is as:
input[type="text"] {margin-right:1px;}
input[type="radio"] {margin-right:5px;}
.spaceUnder td:first-child {width:50px;}
Use :
input{
margin-right:1px;
}
For bringing textboxes near to the label put them in the same td.
See this Fiddle
just follow the image and create a new css rule and update css rule.Hope it will be helpful!
Step: 1
Step:2
I have an HTML template in my Apps Script project that I am trying to evaluate. I keep getting a server error (not very helpful), but I can't find anything while debugging. I tried the running result from getCode(), but no errors there. Then I also ran output.$out.getContent() (as described here https://developers.google.com/apps-script/html_service) which gives me the expected html output.
I would attach the HTML file but it contains a lot of variables and I have trouble creating a lean version with the error. I am hoping someone knows a better or the right way to debug these files.
The html file:
<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>
<?= userForm.userName ?>
</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>
The relevant part of the script:
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();
EDIT:
After using the Caja Playground I found an error in this line:
<div style="color: #FFFFFF; background-color: <?= userForm.pastColor ?>; border: 1px solid white; width: 28px; height: 28px; float: right;" title="<?= userForm.pastApplications ?>">
Could it be that using scriptlets inside attributes isn't supported?
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.
Without touching your html, I tried this slight variant of your .gs file:
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();
}
This works fine for me. I suspect that something is wrong with one of the values in your variables.