This validation JS used to work untill

Results 1 to 2 of 2

Thread: This validation JS used to work untill

  1. #1
    Join Date
    Dec 1969

    Default This validation JS used to work untill

    Hi guys, <BR><BR>The below validation script used to worked until I changed some field names to start with 1 (1stAddress1,1stAddress2 etc). <BR><BR>Now any element I try to validate starting with 1 causes the script not to work. I take it Javascript doesn&#039;t like "1" unless its properly addressed.<BR><BR><BR>&#060;script language="Javascript1.2"&#062;<BR>&#060;!--<BR>function checkform (form) {<BR> var v = new VerifyForm();<BR><BR> if ( ! v.hasValue(form.FirstName) )<BR> v.addError(form.FirstName, "Please enter your: \"First name\".");<BR> if ( ! v.hasValue(form.LastName) )<BR> v.addError(form.LastName, "Please enter your: \"Last name\".");<BR>// if ( ! v.hasValue(form.1stAddress1) )<BR>// v.addError(form.1stAddress1, "Please enter your: \"Address\".");<BR>// if ( ! v.hasValue(form.1stAddress2) )<BR>// v.addError(form.1stAddress2, "Please enter your: \" Town or City\".");<BR>// if ( ! v.hasValue(form.1stPostCode) )<BR>// v.addError(form.1stPostCode, "Please enter your: \"Post code\"."); <BR> if ( v.hasValue(form.Email) && ! v.validEmail(v.getValue(form.Email)) )<BR> v.addError(form.Email, "Invalid E-mail address"); <BR>// if ( ! v.hasValue(form.1stUniversity) )<BR> // v.addError(form.1stUniversity, "Please enter your: \"University\".");<BR> if ( ! v.hasValue(form.C_1) )<BR> v.addError(form.C_1, "Please select your: \"Career choice\" under section 2.");<BR> <BR>// Alert box for app saving.<BR>alert(&#039;Your application is about to be saved. This process could take up to 30 seconds to complete.

    &#039;+&#039;Please wait till you receive the saved confirmation on your screen. Your screen may remain blank or unchanged for some time before you get your confirmation.

    &#039;+&#039;Please click "OK" below to close this box and save your application.&#039;);<BR><BR> <BR> return v.showErrors(&#039;Oops! Your form input has some problems:
    &#039;,<BR> &#039;
    Please fill out the form properly and try again!&#039;);<BR>}<BR><BR>// --&#062;<BR>&#060;/script&#062;<BR><BR><BR>Can anyone tell me what I need to modify to make the script work again? <BR><BR>Cheers<BR><BR>James

  2. #2
    Join Date
    Dec 1969

    Default Can't have a field name start with digit

    It confuses the hell out of JS.<BR><BR>Just put an underline on the front of the name, if you want it to start with a digit, otherwise.<BR><BR>

Posting Permissions

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