Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unterminated String Constatnt erorr in java script

    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

  • #2
    Regular Coder
    Join Date
    Jul 2007
    Location
    UK
    Posts
    223
    Thanks
    0
    Thanked 14 Times in 14 Posts
    You need to put the contents of your onclick in quotes, like this:
    Code:
    <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!

  • Users who have thanked mcjwb for this post:

    ykumarreddy (10-15-2008)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •