field validations - asp or javascript?

Results 1 to 2 of 2

Thread: field validations - asp or javascript?

  1. #1
    Join Date
    Dec 1969

    Default field validations - asp or javascript?

    I&#039;ve a form on which there are 50 fields which consisit of radio buttons, checkboxes, and dropdown & text boxes. Now for all textboxes I&#039;ve to check - value entered is either alphabets or numbers and not any special characters. What will be a good way to do this write a javascript fuction? call that on each input text box?<BR><BR>Later on I alos have to apply proper formatting option. for eg: telephone number, proper case for name etc..<BR><BR>This is what I&#039;m going to use:<BR><BR>function charnumvalidate(field) {<BR>var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ0123456789"<BR>var ok = "yes";<BR>var temp;<BR>for (var i=0; i&#060;field.value.length; i++) {<BR>temp = "" + field.value.substring(i, i+1);<BR>if (valid.indexOf(temp) == "-1") ok = "no";<BR>}<BR>if (ok == "no") {<BR>alert("Invalid entry! Only characters and numbers are accepted!");<BR>field.focus();<BR>;< BR> }<BR>}<BR><BR>&#060;input type="text" name="txtloginid" maxlength="15" onBlur="charnumvalidate(txtloginid)" &#062;<BR><BR>I know Bill will have a better solution then what I&#039;ve here.!! <BR><BR>Thanks in advance

  2. #2
    Join Date
    Dec 1969

    Default RE: field validations - asp or javascript?

    here&#039;s what I use (server-side and client-side with only minor changes)<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