Many times we have to show the visitors posted data in a form and show them the form again. This happens due to several reasons and one of the main reason is failure of entered data or failure of data validation.
In an example say the visitor has entered all the details in a signup form but the user id entered by the member is already used by some one else. Such a situation can be checked only after the visitor enters his or her choice of id. In such a case we have to show one error message and ask the user to try one more user id. ( you can see how the signup form works with to total login script etc here ) Here if the user has already entered all other details like email, address, gender etc then it is not a good idea to ask the visitor to enter them again. We can retain the entered date in respective fields and ask for necessary change in selection of user id.
So the main question is how to retain the value of the entered data in different components of the form. If some one has selected female as gender then the form should retain that value and by default should show female as selected. Same way all input text box, drop down list box and check box should retain the value already entered by the user.
For most sticky forms, submit with POST and redisplay the validated values on the same page. Avoid putting personal or sensitive form values into the query string because URLs can be logged, bookmarked, or shared. If you use a redirect-after-POST workflow, keep only non-sensitive state or a short server-side reference in the redirect.
For the HTML structure behind these examples, see the HTML form tutorial.
We will discuss post back of data of each component of a form. We will start with a simple text box and move to other form components like period button, drop down list, text area and check box. We will focus one component in one tutorial and at the end we will create DEMO form using all the components using all our learning.
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery,
and web development at plus2net. The tutorials focus on clear explanations, working
examples, and code that readers can test and adapt while learning.
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com
Rajesh
22-06-2012
I want to design a form where user select one option of a drop down then the same table is searched and then the next drop down box shows only those options related to first drop down selection as for example we have a medicine table where name,code,date-of-exp,quantity fields are there in first drop down all medicine name should appear , when one select one medicine then all exp date [there is a possibility that for one medicine different exp dates medicine is available] of selected medicine should display , when one select one exp date then all medicine of this exp date should appear. Pl advice
✖
We use cookies to improve your browsing experience. . Learn more