Jump to content

Can form elements retain their values ?


Paulhar

Recommended Posts

Hi All,I have a registration form with several text boxes for name, address etc, a radio button for Male/Female, 3 drop down lists for date, month and year of birth and a text box for a password. I'm validating the user input in the same page and if validation fails then the password field clears, the date, month and year of birth go back to 1st Jan 2008 and the Male/Female selection goes back to 'Male' even if 'female' was selcted.If the only problem with the user input was that the username was already taken I don't want the user to have to re-enter their date of birth, password and gender - they may not even notice that they need to.Hopefully someone will tell me there's a simple way around this.ThanksPaul

Link to comment
Share on other sites

I think ASP.NET has a way to persist data like that across forms somewhat automatically, I don't have much experience with .NET though. Most people probably just do it manually, i.e. when displaying the form you check if a value was already submitted and add it to the form element tag if so. Checkboxes and radio buttons have an attribute called checked that you would set, dropdown lists use selected instead, normal text fields have a value attribute, and with a text area you just put the value as the contents of the text area tag.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...