hey, i have a problem making subselects, i have this code and i want to use it
in rails:
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function setOptions(chosen) {
var selbox = document.myform.geotagid;
selbox.options.length = 0;
if (chosen == " ") {
selbox.options[selbox.options.length] =
new Option(''Please select one of the options above
first'','' '');
}
if (chosen == "1") {
selbox.options[selbox.options.length] = new Option(''Foster Park
2'',''1'');
selbox.options[selbox.options.length] = new Option(''Foster Park
4'',''8'');
}
if (chosen == "5") {
selbox.options[selbox.options.length] = new
Option(''None'',''none'');
}
if (chosen == "15") {
selbox.options[selbox.options.length] = new
Option(''None'',''none'');
}
}
// -->
</script>
</head>
<body>
<form action="#" id="myform" name="myform">
<select id="clientid" name="clientid"
onchange="setOptions(document.myform.clientid.
options[document.myform.clientid.selectedIndex].value);">
<option value="15">Brutyn NV</option>
<option value="5">Odevaere (VME res.)</option>
<option value="1">VME Complex Foster</option>
</select>
<br />
<select name="geotagid" id="geotagid">
<option value=" " selected="selected">Please select
one of the options above
first</option>
</select>
</form>
</body>
</html>
i also use ajax for this, this is the code
<%= form_remote_tag ( :url => { :action => :new, :id => @caller_id
},
:update => "div_info" ,
:complete => "
new
Ajax.Updater(''list'',''/callerids/list/,{asynchronous:true,
valScripts:true});
" ) %>
<%= render_partial ''form'' %>
<%= submit_tag("Create", :id =>
''form-submit-button'') %>
<span id=''busy'' style="display:
none">Creating...</span>
<%= end_form_tag %>
Now my problem is: how can i name the remote form???
cuz i need this in my code see ''var selbox =
document.myform.geotagid;'' and
others. i want to use names because in the background i have also forms for
searching, so i dont want to use numbers like forms[1] or forms[2].
can anyone help me?? or have any expirence in this?
later on i want to write the javascripts value with a loop for each client.
I have tried it with ajax, that works partial but, i selected the first list,
the second list is created and the i submit and the change a whole different
area of the page he shouldnt do.
thx in advance