Forum: Ruby on Rails making sub selects

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
brutyn_nick (Guest)
on 2005-12-05 16:34
(Received via mailing list)
hey, i have a problem making subselects, i have this code and i want to
use it
in rails:

<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');
// -->

<form action="#" id="myform" name="myform">
<select id="clientid" name="clientid"
<option value="15">Brutyn NV</option>
<option value="5">Odevaere (VME res.)</option>
<option value="1">VME Complex Foster</option>
<br />

<select name="geotagid" id="geotagid">
 <option value=" " selected="selected">Please select one of the options



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,
" ) %>
	<%= 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;'
others. i want to use names because in the background i have also forms
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

I have tried it with ajax, that works partial but, i selected the first
the second list is created and the i submit and the change a whole
area of the page he shouldnt do.

thx in advance
This topic is locked and can not be replied to.