IF ENDIF ..

Results 1 to 3 of 3

Thread: IF ENDIF ..

  1. #1
    Raymond Guest

    Default IF ENDIF ..

    I have a form that submits information, and I want to verify that there was information entered in. I currently use IF statements to accomplish this:<BR>If IsEmpty(request.form("First")) or request.form("First")="" then<BR> response.write "&#060;center&#062;&#060;b&#062;Missing the following required field: &#060;B&#062;First Name&#060;/B&#062;."<BR> response.write "&#060;form&#062;"<BR> response.write "&#060;input type=&#039button&#039 value=&#039Retry&#039 onclick=history.back()&#062;"<BR> response.write "&#060;/form&#062;"<BR> response.end<BR>Else<BR> Name = request.form("First")<BR>End If<BR><BR>What I would like to do is create a procedure that you can tell it the name of the entries and it would check to make sure that they all are filled in, and if not display an error page.<BR><BR>Any suggestions or pointers?<BR><BR>Ray<BR> <BR>

  2. #2
    Brad Kingsley Guest

    Default RE: IF ENDIF ..

    A client-side solution would be to use JavaScript and validate the data based on the onSubmit event of the form. That is compatible with most browsers.<BR><BR>Server-side you can open a loop on the request.form collection, loop through each value and make sure that it is not empty or null.<BR><BR>Similar to:<BR><BR>for each FormItem in request.form<BR> if request.form(FormItem) = "" then<BR> &#039it was blank<BR> else<BR> &#039ok<BR> end if<BR>next<BR><BR>Just threw this together on a whim, so it&#039s by no means a solution, but it should give you an idea of how to proceed towards the final solution.<BR><BR>-Brad Kingsley, MCP - NT, IIS4<BR>Reliable Windows NT Web Hosting<BR>ORCS Web, Inc - http://www.ORCSWeb.com

  3. #3
    Steve Rowson Guest

    Default RE: IF ENDIF ..

    You really need to do it using Javascript because this works client side - so before the form is sent to the server it is validated. Your method is making demands on the server that aren&#039t necessary. If you can&#039t write java use the data validation in FrontPage, then strip out the webbots and you can get at the code which you can then modify to display meaningful messages etc.

Posting Permissions

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