H
hanseymoon
How do you create a text input box, which shows a default value of 1+
and blocks the user from deleting it? Thanks so much!
)
and blocks the user from deleting it? Thanks so much!
[email protected] said:How do you create a text input box, which shows a default value of 1+
and blocks the user from deleting it? Thanks so much!)
If you want a text field not editable by user a.k.a. read-only, you
should use respective attribute:
<input type="text" name="super_field" value="1+" readonly="readonly" />
(this is an xhtml syntax)
If you want your form having a parameter but it is not necessary to
show it to the user it's appropriate to use a hidden field:
<input type="hidden" name="...." value="..." />
Is it possible to have your cake and eat it too, that is have a text
input that works as a input, displaying 1+, and allowing the user to
input more, while not allowing 1+ to be deleted? Is this beyond the
limits of JS?
How do you create a text input box, which shows a default value of 1+
and blocks the user from deleting it? Thanks so much!)
Is it possible to have your cake and eat it too, that is have a text
input that works as a input, displaying 1+, and allowing the user to
input more, while not allowing 1+ to be deleted? Is this beyond the
limits of JS?
Essentially apply the onchange handler to the form element, make the
handler a function which checks of the user has added text to the form,
or subtracted it, something like:
function checkFormValue(formElement)
{
if(formElement.value.length < 3)
{
formElement.value = "1 + ";
}
}
One said:On Oct 15, 3:41 am, "John Postlethwait" <[email protected]>
wrote:
Check the first two to four characters to see if they match 1+, 1 +, or
1+ , and then add it back.....
Don't make it harder than it has to be
But, your function doesn't work the way you think it would with regards
to what the OP asked. Test it. Type in "Humpty Dumpty" and see what
gets changed...
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.