| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Member | I am making a custom submission form for one of my webpages and was wondering what is the best way to validate the information entered into the form. Should I use javascript with a pop-up button for errors or should I use ASP code to verify and redirect? I want the contents of the form to remain intact since in would be a bit of an inconvience to have to rewrite everything, so if I go with ASP is there an easy way to repopulate a form or do I have to custom build it with variables? Including one for posting the error at the top of the page? The page as various forms I have to submit one after another till everything is done, all of which are located on the same ASP page, is that ok?
__________________ AEInbetween |
| |
| | #2 (permalink) |
| Domains my Dominion | You should use ASP (server-side) for validation purposes. Some basic validation in javascript is also a plus (quicker and it prevents round trips between browser and server). But it may be disabled on the client browser. Never ever rely on client-based validation ! Also you can program your form to call itself so that if errors are reported, it can remember the input on the previous screen so it need not be type in again.
__________________ Buy now - MassDeveloper.com $500 |
| |
| | #3 (permalink) |
| NamePros Member | I see your point, so ASP validation it is (I was leaning towards this anyway). May seem silly but how do I get it to call itself and retain it's values?
__________________ AEInbetween |
| |
| | #4 (permalink) | |
| NamePros Member | Quote:
sorta like <% response.write("<input type=hidden name=UID value=" & request.form("UID") & ">") %> Thats quick and cheesy. Someone could easily fake their header and pass you an unexpected/unwanted value. I prefer to vet the form values in the head and assign them to variables that you use to load the form... <% dim ok_value ' checks the value is a number. ' you'd probably want real bounds checking here.. if (isnumeric(request.form("UID"))) then ok_value=request.form("UID") end if . . . response.write("<input type=hidden name=UID value=" & ok_value & ">") %> Late at night and I'm pretty tired. apologies for any syntax errors | |
| |
| | #5 (permalink) |
| NamePros Member | Thanks! I'll try it out later. Muchas Gracias!
__________________ AEInbetween |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |