I have a simple HTML form. I have a Countries javascript array that is included with each page request. This populates my Country SELECT list. I perform simple validation with javascript and more complex validation server side. Therefore, there remains the possibility that server side validation will catch an error where javascript validation did not.
So, I need to return the form back to the user to correct the error(s). I'm great with creating select lists server side, know all about that. But not clear on how I would use my javascript countries array and make that display what the user selected previously before the postback. For example, say my user selected "United States". But my server side validation caught an error with another field and sent the form back to the user. I need United States to still be selected for the user using that javascript countries array.
This is a simple form post back, not using ajax.
How may I achieve this?
Aucun commentaire:
Enregistrer un commentaire