|Change data in field after submit?|
sending a defalt value in html form fields.
I have a simple problem (I hope).
I wanted the text fields full instead of extra text on the page,
so I'm using the "onfocus" and "onblur" events in a form.
value='Enter Your First Name Here'
The problem is, if they don't enter any information,
the script captures the value data instead.
Here's the complete form:
<form method='POST' action='http://www.MYWEBSITE.com/cgi-bin/arp3/arp3-formcapture.pl'>
<p>Step 1:<br><input type='text' name='first_name' size='30'value='Enter Your First Name Here'
<input type='hidden' name='capitals' value='1'>
<p>Step 2:<br><input type='text' name='email' size='30'value='Enter Your Email Here'
<p>Step 3:<br><input type='text' name='custom_petname' size='30'value='Enter Your Pets Name'
<input type='hidden' name='subscription_type' value=''><div align='center'><center>
<p><input type='image' SRC="images/Green%2001-Get%20It%20Now%20Big.png" style=
"BORDER-BOTTOM: black solid; BORDER-LEFT: black solid; WIDTH: 160px; HEIGHT: 36px; BORDER-TOP: black solid; BORDER-RIGHT: black solid"
<input type='hidden' name='id' value='2'>
<input type='hidden' name='extra_ar' value=''>
<input type='hidden' name='first_name_man' value='1'>
The form captures "Enter Your Pets Name" as the pet's name.
I wouldn't mind if the captured data was blank, but this is a problem.
I know I can leave the field blank if they click the field, using "onfocus=null",
but if they don't even click the field, the text doesn't clear.
Ultimately, if they don't enter anything,
I would like to send "your pet" to the string.
Any help would be great, this is just a bit beyond me.
And thanks for your time everyone!
You got a great place here :)
<input type="hidden" name="default-email" value="Enter Your Email Here">
Program the script to scan the submitted field names for "default-", extract the corresponding field name/value pairs and process the form data accordingly.
I wish I could edit the formcapture.pl,
but it is part of a script I bought, and it's encrypted :(
Thanks for the thoughts though!
I was actually looking at this:
But my thought is, if the user has it disabled,
wouldn't that leave blank fields on the form,
with no explanation about what they were?
newer browsers also use the placeholder attribute in input fields
<input type="text" placeholder="Enter Your First Name Here" value="">