variable passing

Results 1 to 2 of 2

Thread: variable passing

  1. #1
    Join Date
    Dec 1969

    Default variable passing

    I have a form where I want to do error checking. How I&#039m doing that is checking if a field is blank, then redirecting to an html page that says they left a field blank. What I want to do is let them know which field they left blank, but I don&#039t know how to pass that field name over to the error page. Any ideas?<BR><BR>Here&#039s part of my code where I redirect them:<BR>If Len(strFN) = 0 Then<BR> Response.Redirect("/onlinereg/error.htm")<BR>End If<BR>

  2. #2
    Persesus Guest

    Default RE: variable passing

    Redirecting people just to let them know a field was filled in incorrect or not at all can be VERY annoying. You can let the user know this instantly on the same page.<BR><BR>On your form tag insert the onsubmit handler and name property EG.<BR>&#060;Form Name="MyForm" onSubmit="return ValidateForm"&#062;<BR><BR>For example here lets say you had a textbox called Field1<BR><BR>Now somewhere add the Script:<BR>&#060;Script Language="VBScript"&#062;<BR> Function ValidateForm<BR> If MyForm.Field1.value = "" Then<BR> Msgbox "Hey you left Field1 empty!"<BR> Validate = False<BR> End If<BR> End Function<BR>&#060;/Script&#062;<BR><BR>You could repeat the IF End If Statement for each control on your form.<BR><BR>Hope this solves your problem.<BR>Persesus.

Posting Permissions

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