473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

how to inhibit form submission for user input validation

i need help,
this is my code for my form:
Expand|Select|Wrap|Line Numbers
  1. print header;
  2.   print start_html('Assignment 2'),
  3.     start_form(-action=>'lwpmsample.pl',-method=>'POST'),
  4.       "Option: ", popup_menu(-name=>'myOption',
  5.                              -values=>['Tag']),
  6.     p,
  7.       "URL of page to be changed: ", textfield(-name=>'urlToBeChanged',
  8.                                                -size=>'30',
  9.                                                -maxlength=>'150'),
  10.     p,   
  11.       "Name tag to be changed: ", textfield(-name=>'tagToBeChanged',
  12.                                             -size=>'30',
  13.                                             -maxlength=>'50'),
  14.     p,      
  15.       "Name to be changed to: ", textfield(-name=>'newName',
  16.                                            -size=>'30',
  17.                                            -maxlength=>'50'),
  18.     p,
  19.     submit(-value=>'Submit'),
  20.     end_form,
  21.     hr;
  22.   print end_html;
  23.  
how can i prevent the calling of my assign2.cgi whenever the user has entered an invalid data?
Nov 15 '07 #1
5 1614
numberwhun
3,509 Expert Mod 2GB
i need help,
this is my code for my form:
Expand|Select|Wrap|Line Numbers
  1. print header;
  2.   print start_html('Assignment 2'),
  3.     start_form(-action=>'lwpmsample.pl',-method=>'POST'),
  4.       "Option: ", popup_menu(-name=>'myOption',
  5.                              -values=>['Tag']),
  6.     p,
  7.       "URL of page to be changed: ", textfield(-name=>'urlToBeChanged',
  8.                                                -size=>'30',
  9.                                                -maxlength=>'150'),
  10.     p,   
  11.       "Name tag to be changed: ", textfield(-name=>'tagToBeChanged',
  12.                                             -size=>'30',
  13.                                             -maxlength=>'50'),
  14.     p,      
  15.       "Name to be changed to: ", textfield(-name=>'newName',
  16.                                            -size=>'30',
  17.                                            -maxlength=>'50'),
  18.     p,
  19.     submit(-value=>'Submit'),
  20.     end_form,
  21.     hr;
  22.   print end_html;
  23.  
how can i prevent the calling of my assign2.cgi whenever the user has entered an invalid data?
I am not sure what "assign2.cgi" is as your action specifies the script "lwpmsample.pl". I would have lwpmsample.pl process the form and validate it to ensure the entries are as expected and meet criteria and then have it call your next script if they are correct.

Regards,

Jeff
Nov 15 '07 #2
oh yeah, the action is lwpmpsample.pl
i understand your suggestion. but the validation that i want to do is putting asterisks in the fields where invalid data has been entered. that is, not navigating away from the form unless all data are valid, without using another webpage that has a "go back and try again" link. is it possible to do this in perl?
Nov 15 '07 #3
numberwhun
3,509 Expert Mod 2GB
oh yeah, the action is lwpmpsample.pl
i understand your suggestion. but the validation that i want to do is putting asterisks in the fields where invalid data has been entered. that is, not navigating away from the form unless all data are valid, without using another webpage that has a "go back and try again" link. is it possible to do this in perl?
I am sure that you could set the default value for a text area to be asteriks if nothing was entered, but from a web developer standpoint, I fiind it more of a standard to do something like change the font color of the sections that need to be filled out to be something like a bright red, that way they stand out. The asteriks may not be enough of a "clue" to some users.

But, that is just a suggestion.

As for the asteriks, as I said, if you generated the page with a cgi page, then you can have the code be changed to have asteriks, but personally, I would consider the font color change instead.

Regards,

Jeff
Nov 15 '07 #4
KevinADC
4,059 Expert 2GB
Is this school work?
Nov 15 '07 #5
ok thanks a lot ^_^ a friend of mine was able to give me help. the solution to my problems is subroutines and not separating the generation of a form and perl script into two files.
Nov 16 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: AnnMarie | last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it works fine in IE. I made some of the suggested changes which enabled it to work in IE. I couldn't make all the changes...
2
by: lmeng | last post by:
Hi, I am new to this Forum. Thanks in advance for any kind help. In the following HTML code, when I change the value of one text field then click "Modify" button, if the validation fails a...
10
by: Steve Benson | last post by:
Our regular programmer moved on. I'm almost clueless in Javascript/ASP and got the job of adapting existing code. In the page below, everything works until I added the function checkIt() to...
6
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: ...
2
by: Tim Mills | last post by:
The following code asks the user to sumbit a name, email address, and some text for a quotation via a FORM. I have written a javascript function to evaluate the fields in the form and pop-up a...
9
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
2
by: ddog | last post by:
I have a form with 3 text fields (one of which is a zip code) and 5 combo boxes. The combo boxes are all set with the first value as 'selected' when the page is first displayed. The 3 text fields...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.