Form Validation using VBScript.

Results 1 to 2 of 2

Thread: Form Validation using VBScript.

  1. #1
    Victor N. Rigole Guest

    Default Form Validation using VBScript.

    Need some help!!! I need to be able to display a warning message or some kind of pop up window to inform the user to take some action. I first need to determine if a file exists on the server prior to dipslaying an update asp. I think I can handle how to check for the file. What I need some help with is, if the file is present I want the user to do one of two things. Either delete the file or transmit it to the mainframe for further processing.<BR>What I want to do is display some type of warning message that the file exists and prompt them to either select a Delete button or Transmit button. When either is selected I&#039ll need to execute logic to perform their choice. How can this be done with VBScript?<BR><BR>Thanks!

  2. #2 Guest

    Default RE: Form Validation using VBScript.

    Firstly, why VBScript?<BR><BR>I strongly recommend that you use JavaScript for client-side, unless you are only targetting Internet Explorer, and you are already proficient at VBS.<BR><BR>Having said this I think that what you want to do is easier in VBS. It would look something like this:<BR>&#060;script language=VbScript&#062;<BR>Sub Button_OnClick<BR>UserInput=MsgBox("Do you want to delete the file? Click Yes to delete or No to process.", vbYesNoCancel + vbCritical, "File Processing Options"<BR>Select Case UserInput<BR>case VbYes<BR>&#039 Action to delete<BR>Case VbNo<BR>&#039 Action to Process<BR>Case VbCancel<BR>&#039 Action if user presses the cancel button<BR>end Case<BR>end Sub<BR>&#060;/script&#062;<BR><BR>You would then need to attach this action to the Click event of a button.<BR><BR>Note: I have not tested this code and it may not work in its present form. I usually use client-side java for this type of thing. So I am not sure of the exact details for doing it in VBS. I have provided this code as a guide, because thats what you requested. To do it with java would be a little more complex, as there is no equivalent to the MsgBox function. Therefore you would need to open a new browser window, that simulates a msgbox. This window would contain JS to do something similar to my code above.

Posting Permissions

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