I have a
<form method=post>
and I have a
<input type=text name=honnan value="">
in it.
Are there any methods to pre-fill the VALUE part?
It’s easy when there’s only 1 thing to fill in to the VALUE, but I need several things to be pre-filled in to the VALUE.
e.g.:
ABC
DEF
GHI
So I need to give the choice to have several values in the VALUE pre-filled, just like if the browser cached the once written value to it.
A
<select id="old_sl" tabindex="0" name="sl">
<option SELECTED value="auto">ABC</option>
etc.
is not a solution because I want that the user could write custom values in the VALUES text form.
You can use JavaScript for this. Have JavaScript watch that field (e.g. use event handling to determine when the user is typing) and when the user starts to type in a value you can check to see if it matches anything of the predefined values (e.g. ABC, DEF, GHI, etc) and if it does offer them a chance to select it from a drop down that is displayed underneath that text field. Otherwise, let them continue to add their own custom value.
This is known as autocomplete. Popular JavaScript frameworks like jQuery and Prototype/Scriptaculous offer tools for making this easy to do.