Forums

External Java Source URL - how to include?

itchibahn 09 Dec, 2009
Within the form need to call java function at external site as show snippet below. The source works in standard webpage, but won't work in ChronoForms. How do I add that java script src to "Form JavaScript without the script tags"?

...
<input type='button' onclick='showProgress()' value='Prequalify Now!' style='width: 136px' /><input type='hidden' name='company_id' value='1234567789' />

<b>Please Wait</b><img name='progress_image' id='progress_image' src='blank.gif' width='65px' height='19px' align='absmiddle' alt='...' /><br />
...
...
<script src='http://someExtSite.net/Methods.js' language='javascript'></script>
</form>
nml375 09 Dec, 2009
Hi,
You'll have to use some php-code for this:

Add something like this at the top of your form code:
<?php
global $mainframe;
$document = JFactory::getDocument();
if ($mainframe->isSite())
  $document->addScript('http://someExtSite.net/Methods.js', 'text/javascript');
?>


/Fredrik
itchibahn 12 Dec, 2009
Thanks for reply.
I tried as you suggested it didn't work.
Is there an issue copying form code exactly from standalone page? The form appears fine, but submit isn't doing anything. Chrono test link: http://www.isot.com/index.php?option=com_chronocontact&chronoformname=dsl-prequal
Standard html works just fine: http://www.isot.com/index.php/signup/dsl-prequalification.html

<?php
  global $mainframe;
  $document = JFactory::getDocument();
  if ($mainframe->isSite())
    $document->addScript('http://my.extsite.net/Methods.js', 'text/javascript');
?>
<table cellpadding='2' cellspacing='0' border='0' id='Prequal'>
	<tr><td colspan='2' style='font-size:85%;padding-left:0px;color:#001C79;'>
		<input type='checkbox' onclick='dryDSL()' id='isDryDSL' name='isDryDSL' /><b>Check Address Only</b>
	</td></tr>
	<tr id='phoneInfo' style='display:;'><td colspan='2' align='left'>
		<span id='phoneVal' style='display:none;font-size:90%;'><b style='color:red;'>*Invalid: 123-123-1234</b></span><b>Phone Number:</b><br /><input type='text' id='phone' name='phone' style='width: 130px' />
	</td></tr>
	<tr id='phoneText' style='display:none;font-size:85%;font-style:italic;'><td colspan='2' align='left' style='padding-top:0px;padding-left:4px;'>
		<div style='width:130px;'>*This option is only available if your address is in a Verizon coverage area</div>
	</td></tr>
	<tr><td colspan='2' align='left'>
		<span id='addrReq' style='display:none;font-size:90%;'><b style='color:red;'>*Required</b></span><b>Address:</b><br /><input type='text' id='address' name='address' style='width: 130px' />
	</td></tr>
	<tr><td colspan='2' align='left'>
		<span id='unitReq' style='display:none;font-size:90%;'><b style='color:red;'>*Required</b></span><strong>Unit Type and #:</strong><br /><select name='unit_type' id='unit_type'><option value=''></option><option selected='selected' value='None'>None</option><option value='APT'>Apartment</option><option value='BLDG'>Building</option><option value='FLR'>Floor</option><option value='LOT'>Lot</option><option value='RM'>Room</option><option value='SLIP'>Slip</option><option value='SUIT'>Suite</option><option value='TRLR'>Trailer</option><option value='UNIT'>Unit</option><option value='WNG'>Wing</option></select> <input type='text' id='unit_number' name='unit_number' style='width:47px;.width:43px;_width:48px;' maxlength='10' />
	</td></tr>
	<tr><td colspan='2' align='left'>
		<span id='cityReq' style='display:none;font-size:90%;'><b style='color:red;'>*Required</b></span><b>City:</b><br /><input type='text' id='city' name='city' style='width: 130px' />
	</td></tr>
	<tr><td align='left' valign='bottom' style='padding-bottom:3px;'>
		<span id='stateReq' style='display:none;font-size:90%;'><b style='color:red;'>*Choose</b></span><b>State:</b><br /><select name='state' id='state'><option value=''></option><option value='AK'>AK</option><option value='AL'>AL</option><option value='AR'>AR</option><option value='AZ'>AZ</option><option value='CA'>CA</option><option value='CO'>CO</option><option value='CT'>CT</option><option value='DC'>DC</option><option value='DE'>DE</option><option value='FL'>FL</option><option value='GA'>GA</option><option value='HI'>HI</option><option value='IA'>IA</option><option value='ID'>ID</option><option value='IL'>IL</option><option value='IN'>IN</option><option value='KS'>KS</option><option value='KY'>KY</option><option value='LA'>LA</option><option value='MA'>MA</option><option value='MD'>MD</option><option value='ME'>ME</option><option value='MI'>MI</option><option value='MN'>MN</option><option value='MO'>MO</option><option value='MS'>MS</option><option value='MT'>MT</option><option value='NC'>NC</option><option value='ND'>ND</option><option value='NE'>NE</option><option value='NH'>NH</option><option value='NJ'>NJ</option><option value='NM'>NM</option><option value='NV'>NV</option><option value='NY'>NY</option><option value='OH'>OH</option><option value='OK'>OK</option><option value='OR'>OR</option><option value='PA'>PA</option><option value='RI'>RI</option><option value='SC'>SC</option><option value='SD'>SD</option><option value='TN'>TN</option><option value='TX'>TX</option><option value='UT'>UT</option><option value='VA'>VA</option><option value='VT'>VT</option><option value='WA'>WA</option><option value='WI'>WI</option><option value='WV'>WV</option><option value='WY'>WY</option></select></td><td align='left' valign='bottom'><span id='zipReq' style='display:none;font-size:90%;'><b style='color:red;'>*Required</b></span><b>Zip Code:</b><br /><input type='text' id='zipcode' name='zipcode' style='width:75px;.width:81px;_width:84px;' maxlength='5' />
	</td></tr>
	<tr><td style='font-size:85%;' colspan='2' align='left'>
		<span id='locReq' style='display:none;font-size:110%;'><b style='color:red;'>*Required</b></span><b style='font-size:115%;'>This is a:</b><br /><input id='locationR' name='location' type='radio' value='R' />Residence <input id='locationB' value='B' name='location' type='radio' />Business
	</td></tr>
	<tr><td colspan='2'>
		<input type='button' onclick='showProgress()' value='Prequalify Now!' style='width: 136px' /><input type='hidden' name='company_id' value='RZk76UQ28BaEHBQ3d*%2m%2b' />
	</td></tr>
	<tr style='display:none;position:absolute;' id='progress_row'><td colspan='2' style='padding-top:7px;padding-right:0px;padding-left:0px;' align='center'>
		<b>Please Wait</b><img name='progress_image' id='progress_image' src='blank.gif' width='65px' height='19px' align='absmiddle' alt='...' /><br />
	</td></tr>
</table>
</center>
GreyHead 12 Dec, 2009
Hi itchiban.

Try $document =& JFactory::getDocument(); with the added &

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger