Log in

View Full Version : Drop Down Menu Auto Select



avidcat
08-04-2008, 04:52 PM
In our directory when a user logs in to change their info, the form is auto filled with their initial selections saved in our database.

This is accomplished by placing a small tag into each field such as %%url%%


<input type="text" name="url" size="30" value="%%url%%" />

I want to do the same with a drop down menu but this wont work the same way it does for a field.

Is there a script out there that would allow me to use our %%tags%% in a drop down menu?

thanks

mburt
08-05-2008, 05:54 PM
Well, what you could do is this:

<input type="hidden" id="foo" name="url" size="30" value="%%url%%" />

Dropdown menu?

<select id="menu">
<option></option>
</select>
<script type="text/javascript">
$ = function(e) {return document.getElementById(e);};
var text = document.createTextNode($("foo")["value"]);
$("menu")["options"][0].appendChild(text);
</script>