Web Analytics Made Easy -
StatCounter Problems with form validation - CodingForum

Announcement

Collapse
No announcement yet.

Problems with form validation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resolved Problems with form validation

    I'm working on validating a form and running into a ridiculous error... Even in a simple example the code seems to explode.

    Code:
    function simpleTest()
    {
    	var please = document.submit.1_radio;
    	if(NoneWithCheck(please))
    	{
    		alert("Hey listen");
    	}
    }
    The error I'm getting is "missing ; before statement" (Firefox Error Console). The arrow points to the "submit" part of the statement. The form name in the document is submit, and the radio buttons are all named 1_radio. Does this maybe have something to do with the fact that the form is within a div?
    Last edited by thefil; Apr 1, 2009, 11:52 AM.

  • #2
    Two things: A form, named submit.... considering submit refers to a method... and a radio button, named 1_radio... and of course the solution:

    1. Rename your form.
    2. Start the name of your button with a character, rather than a number.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

    Comment


    • #3
      Thanks, that does away with one error. Unfortunately it brings me back to another one I had...

      The code now looks like this:
      Code:
      function simpleTest()
      {
      	var please = document.temp.radio1;
      	if(NoneWithCheck(please))
      	{
      		alert("Hey listen");
      	}
      
      }
      And the JS error is "NoneWithCheck is not defined." I had run sample code from a website with this JS and it works fine, only here am I getting the error.

      Comment


      • #4
        And the JS error is "NoneWithCheck is not defined."
        Means there is no function defined, with name NoneWithCheck
        Could you post your complete code. or a link would be better.
        Digitalocean Cloud Hosting (Referral link - get $10 free credit) Fameco

        Comment


        • #5
          I have resolved the problem on my own. The internet had led me to believe the function was a stock Javascript function, which it is not. Thanks for all the help.

          Comment

          Working...
          X