Client side form validation

Results 1 to 3 of 3

Thread: Client side form validation

  1. #1
    Join Date
    Dec 1969
    Posts
    9

    Default Client side form validation

    I have an asp page with a form. I have an onSubmit form handler which does client side validation such as Field X should not be blank etc.<BR><BR>It works fine. However, this validation code can be seen in the source of my page. I have seen a lot of sites where their form validation code does not show up. I read on this site that if you enclose your Validate function in &#060;% %&#062;, it will not be seen. I understand this but doesn&#039t this make it server side validation. <BR>All the other sides that I have seen, have the client side validation, still there code cannot be seen by View Source. How do we accomplish this ?

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Client side form validation

    You&#039re right about the server-side validation thing. Once it goes in the &#060;%...%&#062;, it is server side code. Chances are, they are using a validation file. You can simply include this validation file without having to put all the code in each and every html page that needs client-side validation.<BR><BR>The include comment for this is something like:<BR>&#060;SCRIPT LANGUAGE=JavaScript SOURCE=SomeFile.js&#062;<BR><BR>Or something like that, personally I have never used it. However, you can see the filename when you do a View/Source, and then you can just type the name of the validation file in your browser window and still view the validation code.<BR><BR>Bottom line- if you absolutely can&#039t afford to have people look at your validation code, you&#039ve gotta make it all server-side.<BR><BR>Happy Programming!

  3. #3
    Join Date
    Dec 1969
    Posts
    2,493

    Default RE: Client side form validation

    I don&#039t know what your function code looks like but normally when you put a function on an html page you do it like this.<BR>This would go in the body of the HTML.<BR><BR>&#060;Script Language="vbscript"&#062;<BR>&#060;!-------------<BR>Function Name()<BR>the code<BR>End Function<BR>--------------&#062;<BR>&#060;/Script&#062;<BR>the script tags don&#039t show in the browser and the code is hidden<BR><BR>Steve Miller

Posting Permissions

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