Simple HTML form
This has to be easy to do but for the life of me I can't work out how to do it,
Ok in my html form that posts to a page I have one field that I need help with and it looks like this Code:
Enter your name <INPUT NAME="Username" value=""> I want to try and hide the part "string:" and not set that as a value but when the user submits the form I want that to be prefixed to the start of that value At the moment the form looks like this Code:
Enter your name do not remove the word string <INPUT NAME="Username" value="string:"> Here is the flow Code:
Enter your name <INPUT NAME="Uname" value=""> Hope some one follows that. |
seems like it's the wrong place to do this, but it's possible. you could try to use the on_submit() function in javascript to modify the data before the submit process completes.
|
You should use javascript:
<html> <script> <!-- function process_submit() { document.myform.Username.value = "string:" + document.myform.Username.value; document.myform.submit(); } //--> </script> <form name="myform" action="1.htm" method="get" onsubmit="process_submit();"> <input type="text" name="Username" value=""> <input type="submit" name="submit" value="Submit"> </form> </html> <!-- OR --> <html> <script> <!-- function process_submit() { document.myform.Username.value = "string:" + document.myform.Name.value; document.myform.submit(); } //--> </script> <form name="myform" action="1.htm" method="get" onsubmit="process_submit();"> <input type="text" name="Name" value=""> <input type="hidden" name="Username" value=""> <input type="submit" name="submit" value="Submit"> </form> </html> |
Just make the 'string:' component part of a hidden field. Use your CGI script that handles the form to concatenate the two field values.
--- rod. |
but why would you even bother? if it's always just going to read "string:" then you'd just manually add it in the stndard code.. no point submitting it back to yourself is there? that's what i would've suggested already, but there was the insistence on a single parameter in that format already...
|
I assumed that 'string:' was just and example or placeholder for some string which may have almost any content and would probably vary in composition for any particular instance of the form.
It really sounds like the original poster is trying to create some functionality traditionally accomplished using cookies and/or hidden fields. Perhaps SimonT could explain something about how he intends to use what he wants. --- rod. |
All times are GMT -5. The time now is 11:09 PM. |