form field question
how can you change an input field within the form so that the entered text is altered by a given string before the user hits submit?
for example, if a user enters "ABC" into the input field, i want to know how the field "trial" be changed so that "DEF" is added to the end (trail=ABCDEF) before the user presses submit button within the form.
Mark Hensler posted this at 06:08 — 11th January 2001.
He has: 4,048 posts
Joined: Aug 2000
more info...
will you always append with the same string?
or is there more logic behind it?.....
if (trial=="this") { trial = "this and that" }
if (trial=="jack") { trial = "jack and jill" }
Mark Hensler
If there is no answer on Google, then there is no question.
elisa posted this at 07:23 — 11th January 2001.
They have: 2 posts
Joined: Jan 2001
i wanna use the same string, no matter what the user enters.
i tried a javascript code, but it didn't seem to reassign the value of "trial."
<script type="text/javascript"></script>
STEV0 posted this at 15:52 — 16th January 2001.
They have: 3 posts
Joined: Jan 2001
you'd access the field with
document.forms[0].trial.value
'so if you want to append to the string when submit is pressed try:
<script>
function poo() {
document.forms[0].trial.value += 'DEF';
}
</script>
<FORM onSubmit="poo()">
.
.
.
hope this helps
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.