954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Preselection of stored value in an input control of a form

I'd would like in a form with an input control, that the first autocomplete value is visible in the textbox instead of a blank field.

Is it possible in javascript ?

Thanks a lot

FlyBoy767
Newbie Poster
2 posts since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

'this what you need?

<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
function insertvalue()
{
document.formname.sometext.value = "default value";
}
</SCRIPT>
</HEAD>

<BODY BGCOLOR="#FFFFFF" onload="insertvalue()">

<FORM NAME="formname">
<INPUT TYPE="text" NAME="sometext">
</FORM>
</BODY>
</HTML>
madmital
Junior Poster
120 posts since Jun 2005
Reputation Points: 10
Solved Threads: 5
 

Thank for you replly but ...
No no,
I'd like to put in the box the first value available with autocomplete.
You know, when you click on a box if your autocomplete is turned on, the browser propose you the stored values in a list.
Thanks

As I search for it I only found a solution in VB with sendkeys function.
But I'd prefer in Java, asp (don't think a server-side could do it), or html.

FlyBoy767
Newbie Poster
2 posts since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

The "autocomplete" is an often very annoying and disruptive "feature" of a particular browser or browser plug-in (like the Google Toolbar). As far as I know, a standardized autocomplete was never made part of the JavaScript DOM, so you can't do what you're trying to do.

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You