Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    96

    Unanswered: Server side form validation

    Hello,
    I want to validate a form server side and I am looking for a bit of advice.
    I have done it several times but only with a small amount of data, ie. an email address or a couple of fields and so far the way i have done it is than if the field is empty or the data isn't in the right format I redirect to the same page and add an error message in URL string to be then used on the page.

    I now need to do it for a large form containing text area's etc and want to be able to save the data so the user doesn't have to reenter every thing for just a field missing.
    I am guessing this is way too much to pass in the URL string and would like to know what other options are there (I am using ASP but would think the principals are the same for any languages).
    I thought of saving the data to a table in the DB and reusing it then on a different page (at least in the case of an new insert), would I be on the right track?

    Thanking you for any sugestion,
    Regards,
    Olivier

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Well you could pass everything around in session variables....

    So they submit... you populate the session variables for the fields they have entered. If you find a validation problem you populate and error message session variable, redirect back to the page. When you display your page you check for a session variable and populate using that then clear the variable so you are ready for the next submit.

    Does that help at all?

  3. #3
    Join Date
    Aug 2004
    Posts
    96
    Hi there,
    thank you for the session variable suggestion, is ther a limit to how much can be stored in a session variable?

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    the only real limit is the size of the users session and the number of user sessions compared to the amount of available memory on the server...

    you can store anything you want but if your sessions are too big or there are too many of them you may find your server starts to slow down and this may be a problem.

Posting Permissions

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