Hi there,
I've got a form with three fields called:
- surname
- ID
- email address
The user enters the details into one or more of the fields, clicks submit, and this pulls all the data about the person/people searched for.
The user will not always know all of the information, so occasionally, a field will be left blank. However, if no information is entered, I need the default values of the text boxes to be:
- surname
- ID
- email_address
At the moment my form works fine, because I have set a value for each textbox. However, my form looks messy because these values appear in the form.
I would like all of the form fields to appear blank until someone enters the details, but I would like there to be a hidden default value. To acheive this, I was thinking I would need some javascript that says, for example:
if the email address field is left blank, let the value of that field be equal to email_address when the submit button is pressed.
The result I'm hoping for is that the form fields will be blank to the user, but, when the submit button is pressed, any blank fields will be given a value of surname, ID or email_address (depending on the field name).
Would anyone be able to help me with this? Any other ways of achieving the same effect would also be much appreciated.
Many thanks,
Katie
I've got a form with three fields called:
- surname
- ID
- email address
The user enters the details into one or more of the fields, clicks submit, and this pulls all the data about the person/people searched for.
The user will not always know all of the information, so occasionally, a field will be left blank. However, if no information is entered, I need the default values of the text boxes to be:
- surname
- ID
- email_address
At the moment my form works fine, because I have set a value for each textbox. However, my form looks messy because these values appear in the form.
I would like all of the form fields to appear blank until someone enters the details, but I would like there to be a hidden default value. To acheive this, I was thinking I would need some javascript that says, for example:
if the email address field is left blank, let the value of that field be equal to email_address when the submit button is pressed.
The result I'm hoping for is that the form fields will be blank to the user, but, when the submit button is pressed, any blank fields will be given a value of surname, ID or email_address (depending on the field name).
Would anyone be able to help me with this? Any other ways of achieving the same effect would also be much appreciated.
Many thanks,
Katie