...

View Full Version : Unterminated String Constatnt erorr in java script



ykumarreddy
10-14-2008, 10:46 PM
Hi,

can any let me know how to fix this error.

My java script function is

<input type="radio" id="1" name="name" value="1" onclick=submitForm('Industry','Banking','1');>

if I passs like this my java script is working fine.
if i have any spaces in the value i am getting unterminated String error".

<input type="radio" id="1" name="name" value="1" onclick=submitForm('Resource Types','Banking Applications','1');>

Please suggest me how to fix this isse.

Thanks in advance.

Regards,
Kumar

mcjwb
10-15-2008, 12:16 AM
You need to put the contents of your onclick in quotes, like this:

<input type="radio" id="1" name="name" value="1" onclick="submitForm('Resource Types','Banking Applications','1');">


When you don't use quotes(surronding the whole contents of the onclick) the browser will only read up to the first space. Then, when the onclick is executed it will try to execute "submitForm('Resource" and you get the unterminated String error because there is only one single quote.
Hope that makes sense!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum