Setting By default value of a particular HTML variable

rahul0602
Kilo Contributor

Hello 

I need to set a by default table for a particular HTML variable intended to ease the process oF data entry of the user.

find_real_file.pngWhenever, this form loads, What is happening filed should by default have the above table in it

2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

Click on the button highlighted in yellow. And copy the source code from there. Then write an onload script as below

 

var myhtml = 'your source code here which you copied';

g_form.setValue('html field name', myhtml);

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

HI @SanjivMeher , 

this is not working for me. 

function onLoad() {
//Type appropriate comment here, and begin script below

var mySourceCode = '<p><strong>Fill the details below</strong></p>
<table style="border-collapse: collapse; width: 100.957%; height: 153.958px;" border="1">
<tbody>
<tr style="height: 46.1875px;">
<td style="width: 9.37067%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">vendor/pricing</span></strong></span></td>
<td style="width: 8.11567%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Initial Price&nbsp;</span></strong></span></td>
<td style="width: 7.19534%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Final Price</span></strong></span></td>
<td style="width: 10.2073%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Savings</span></strong></span></td>
<td style="width: 9.37067%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Lowest Bidder</span></strong></span></td>
<td style="width: 17.068%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Recommended bidder</span></strong></span></td>
<td style="width: 19.076%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Reason for recommendation</span></strong></span></td>
<td style="width: 8.45034%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">SAN Active</span></strong></span></td>
<td style="width: 11.1277%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Remarks</span></strong></span></td>
</tr>
<tr style="height: 15.3958px;">
<td style="width: 9.37067%; height: 15.3958px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">vendor 1</span></strong></span></td>
<td style="width: 8.11567%; height: 15.3958px;">&nbsp;</td>
<td style="width: 7.19534%; height: 15.3958px;">&nbsp;</td>
<td style="width: 10.2073%; height: 15.3958px;">&nbsp;</td>
<td style="width: 9.37067%; height: 15.3958px;">&nbsp;</td>
<td style="width: 17.068%; height: 15.3958px;">&nbsp;</td>
<td style="width: 19.076%; height: 15.3958px;">&nbsp;</td>
<td style="width: 8.45034%; height: 15.3958px;">&nbsp;</td>
<td style="width: 11.1277%; height: 15.3958px;">&nbsp;</td>
</tr>
<tr style="height: 15.3958px;">
<td style="width: 9.37067%; height: 15.3958px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Vendor 2</span></strong></span></td>
<td style="width: 8.11567%; height: 15.3958px;">&nbsp;</td>
<td style="width: 7.19534%; height: 15.3958px;">&nbsp;</td>
<td style="width: 10.2073%; height: 15.3958px;">&nbsp;</td>
<td style="width: 9.37067%; height: 15.3958px;">&nbsp;</td>
<td style="width: 17.068%; height: 15.3958px;">&nbsp;</td>
<td style="width: 19.076%; height: 15.3958px;">&nbsp;</td>
<td style="width: 8.45034%; height: 15.3958px;">&nbsp;</td>
<td style="width: 11.1277%; height: 15.3958px;">&nbsp;</td>
</tr>
<tr style="height: 15.3958px;">
<td style="width: 9.37067%; height: 15.3958px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Vendor 3</span></strong></span></td>
<td style="width: 8.11567%; height: 15.3958px;">&nbsp;</td>
<td style="width: 7.19534%; height: 15.3958px;">&nbsp;</td>
<td style="width: 10.2073%; height: 15.3958px;">&nbsp;</td>
<td style="width: 9.37067%; height: 15.3958px;">&nbsp;</td>
<td style="width: 17.068%; height: 15.3958px;">&nbsp;</td>
<td style="width: 19.076%; height: 15.3958px;">&nbsp;</td>
<td style="width: 8.45034%; height: 15.3958px;">&nbsp;</td>
<td style="width: 11.1277%; height: 15.3958px;">&nbsp;</td>
</tr>
</tbody>
</table>';
g_form.setValue()

}

function onLoad() {
   //Type appropriate comment here, and begin script below
	
	var mySourceCode = '<p><strong>Fill the details below</strong></p>
<table style="border-collapse: collapse; width: 100.957%; height: 153.958px;" border="1">
<tbody>
<tr style="height: 46.1875px;">
<td style="width: 9.37067%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">vendor/pricing</span></strong></span></td>
<td style="width: 8.11567%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Initial Price&nbsp;</span></strong></span></td>
<td style="width: 7.19534%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Final Price</span></strong></span></td>
<td style="width: 10.2073%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Savings</span></strong></span></td>
<td style="width: 9.37067%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Lowest Bidder</span></strong></span></td>
<td style="width: 17.068%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Recommended bidder</span></strong></span></td>
<td style="width: 19.076%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Reason for recommendation</span></strong></span></td>
<td style="width: 8.45034%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">SAN Active</span></strong></span></td>
<td style="width: 11.1277%; height: 46.1875px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Remarks</span></strong></span></td>
</tr>
<tr style="height: 15.3958px;">
<td style="width: 9.37067%; height: 15.3958px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">vendor 1</span></strong></span></td>
<td style="width: 8.11567%; height: 15.3958px;">&nbsp;</td>
<td style="width: 7.19534%; height: 15.3958px;">&nbsp;</td>
<td style="width: 10.2073%; height: 15.3958px;">&nbsp;</td>
<td style="width: 9.37067%; height: 15.3958px;">&nbsp;</td>
<td style="width: 17.068%; height: 15.3958px;">&nbsp;</td>
<td style="width: 19.076%; height: 15.3958px;">&nbsp;</td>
<td style="width: 8.45034%; height: 15.3958px;">&nbsp;</td>
<td style="width: 11.1277%; height: 15.3958px;">&nbsp;</td>
</tr>
<tr style="height: 15.3958px;">
<td style="width: 9.37067%; height: 15.3958px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Vendor 2</span></strong></span></td>
<td style="width: 8.11567%; height: 15.3958px;">&nbsp;</td>
<td style="width: 7.19534%; height: 15.3958px;">&nbsp;</td>
<td style="width: 10.2073%; height: 15.3958px;">&nbsp;</td>
<td style="width: 9.37067%; height: 15.3958px;">&nbsp;</td>
<td style="width: 17.068%; height: 15.3958px;">&nbsp;</td>
<td style="width: 19.076%; height: 15.3958px;">&nbsp;</td>
<td style="width: 8.45034%; height: 15.3958px;">&nbsp;</td>
<td style="width: 11.1277%; height: 15.3958px;">&nbsp;</td>
</tr>
<tr style="height: 15.3958px;">
<td style="width: 9.37067%; height: 15.3958px;"><span style="background-color: #ffffff;"><strong><span style="color: #000000; font-size: 8pt; background-color: #ffffff;">Vendor 3</span></strong></span></td>
<td style="width: 8.11567%; height: 15.3958px;">&nbsp;</td>
<td style="width: 7.19534%; height: 15.3958px;">&nbsp;</td>
<td style="width: 10.2073%; height: 15.3958px;">&nbsp;</td>
<td style="width: 9.37067%; height: 15.3958px;">&nbsp;</td>
<td style="width: 17.068%; height: 15.3958px;">&nbsp;</td>
<td style="width: 19.076%; height: 15.3958px;">&nbsp;</td>
<td style="width: 8.45034%; height: 15.3958px;">&nbsp;</td>
<td style="width: 11.1277%; height: 15.3958px;">&nbsp;</td>
</tr>
</tbody>
</table>';
	g_form.setValue('backend_html_var',mySourceCode );
   
}


While assigning the source code to mySourceCode variable it's throwing error "unterminated string constant". 

Can you please help here?