Displaying 20 results from an estimated 35 matches for "selectedindex".
2009 Jan 08
4
Problem with disable_with
...Group,
I have a registration.html.erb page with the following JavaScript at
the top which I use to validate form fields:
<script type="text/javascript">
<!--
function validate(){
if ((document.myForm.email_projectname.value=="")||
(document.myForm.email_projecttype_id.selectedIndex<1)||
(document.myForm.email_region_id.selectedIndex<1))
{
alert ("You must fill in all of the required fields!")
return false
}
else
return true;
}
//-->
</script>
further down the page I have the form:
<% form_tag({:action => ''s...
2006 May 20
3
in_place_editor and no access to value
...country id passed like I need to.
<%= in_place_editor ''add_country_area'',
:url => {:action => ''add_country_area''},
:with =>
"''value=''+escape(value)+''country=''+document.add_trip.country.selectedIndex"
%>
Thanks for the help
Brian
--
Posted via http://www.ruby-forum.com/.
2006 Aug 15
2
Extracting the current value of a DOM element
So, say I have two select boxes. One with the letters of the alphabet,
and a second with a list of names. When I select the letter in the
first, how do I, in my onChange function, extract the value I selected
in the first box, to determine what values to populate the second box
with?
I don''t want to submit the form, I''d like to do this with Ajax.
Thanks in advance,
Ben.
--
2007 Mar 26
1
Handling Multiple Select Lists
...";
} else {
str += fobj.elements[i].name + "=&";
}
} else if (fobj.elements[i].tagName == "SELECT") {
var sel = fobj.elements[i];
str += sel.name + "=" +
sel.options[sel.selectedIndex].value + "&";
} else {
str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value)
+ "&";
}
}
//Then return the string values.
return str;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message...
2007 Feb 21
8
Element.addMethods() is not a function after upgrade to 1.7.0
After upgrading to prototype 1.5.0 and scriptaculous 1.7.0 my
autocompleter.local died... firebug reports that effects.js is to
blame calling Element.addMethods();
I can not find out why cause as far as I can see it does exist in
prototype.js.
Any pointers anyone :(
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2006 Feb 07
1
Help needed with conflicting EventObserver
...{
setMake();
}
function setMake() {
var make = document.getElementById("make");
var makere = /ford/;
// Set the make
for (var i=make.options.length-1; i>=0; i--) {
var m = make.options[i].value;
if ( makere.test(m) ) {
make.selectedIndex = i;
var modelAjax = new Ajax.Updater({ success: ''model''},
''/util/model_select_response'', { parameters: ''make=''+m,
onComplete:setModel } );
}
}
}
function setModel() {
var model = document.getElementById(&qu...
2006 Feb 09
5
Ajax.Updater not populating element - please help
...: pars});
}
function setMake(the_make) {
var make = $(''make'');
var makere = new RegExp(the_make);
// Set the make
for (var i=make.options.length-1; i>=0; i--) {
var m = make.options[i].value;
if ( makere.test(m) ) {
make.selectedIndex = i;
}
}
}
function setModel(the_model) {
alert("in set model");
var model = $(''model'');
alert(model.length);
var modelre = new RegExp(the_model);
// Set the model
for (var i=model.options.length-1; i>=0; i--) {
var...
2005 Oct 01
8
Ajax.InPlaceEditor on Safari & Firefox
Hi,
I''ve downloaded the latest svn trunk and was glad to see that
Ajax.InPlaceEditor forms can now be correctly submitted on Safari as
well, with the server response being correctly displayed as well.
The problem is, however, that clicking again on the same element
(after sumbitting it first) will duplicate the submit form. The next
attempt will triplicate it etc, etc...
Could
2006 Jul 02
6
remote form w/ evalScripts:true
...id] },
{ :include_blank => true},
{ :class => "formfield", :onchange => "new
Ajax.Request(''/admin/list_item_links/create?list_item_link
[list_item_type]=List&list_item_link[list_id]=#{@list.id}
&list_item_link[list_item_id]='' +
this.options[selectedIndex].value,{asynchronous:true,
evalScripts:true}); return false;" }
%>
The first example, using the form, results in javascript being
rendered in the browser rather than being executed. Note that it does
say ":eval_scripts => true" and that the resulting javascript does
in...
2006 Jan 06
12
Auto refreshing a page based on select change
Hi all,
I have a select helper form on a web page which contains a list of dates. When
the user selects a date, one of the other forms on the page needs to be updated
based on the newly selected date.
Is there a way to catch this event in Rails? Are we talking Ajax here? Or is
there a simpler way?
Thanks,
Dan
2008 Jan 17
4
JSON query problems
I am constructing a JSON object that is an array of products. Using a
select box, I want to find the object in the array that has an ID that
matches the value from the selectedIndex of the select box and return
the price.
Here is the JSON script:
var products = [{''ID'': 16378, ''Cost'': 100.00},{''ID'': 16377,''Cost'':
112.00},{''ID'': 16376,''Cost'': 141.00}]
I am getting the I...
2006 Jun 09
0
partials and rjs
...d, @country_areas.collect {|c| [c.descr,
c.id]}, {:prompt => "-- Select Area --"},
{:name => "country_area_select", :onfiltered=> "new
Ajax.Updater(''country_area_info'',
''/controller/admin/change_country_area/''+country_area.selectedIndex,
{asynchronous:true, evalScripts:true});" }
%>
<-- form containing partial -->
<form>
<span id="country_area">
<%= render :partial => ''country_area'' %>
</span>
<span id="add_country_area"...
2006 Jun 15
0
return from controller not evaluating script
...id, @country_areas.collect {|c| [c.descr,
c.id]}, {:prompt => "-- Select Area --"},
{:name => "country_area_select", :onChange => "new
Ajax.Updater(''country_area_info'',
''/controller/admin/change_country_area/''+country_area.selectedIndex,
{asynchronous:true, evalScripts:true});" }
%>
--------
Here is the HTTP response I get back using FireBug:
$("country_area").replace(
"<select id=\"country_area_id\" name=\"country_area_select\"
onChange=\"new Ajax.Updater(''country_...
2006 Aug 16
1
how to update a collection_select from another
I have two collection_select in my list.rhtml:
<%= collection_select (:region, :id, @regionall, :id,
:title,html_options={:onChange => "new
Ajax.Updater(''related_provinces'',''/categories/related_provinces/" +
"?id=''+this[this.selectedIndex].value,
{asynchronous:true, evalScripts:true});"}) %><br>
<%= render :partial => "related_provinces" %>
This is my partial:
_related_provinces.rhtml:
<%= collection_select(:region, :id, @provinces, :id, :title) %>
category_controller.rb:
def list
@regi...
2008 Apr 24
2
select_tag and link_to
Does ROR allow passing the chosen value from a drop down using
select_tag into link_to ?
Basically I want to do something like:
<%= select_tag( "name", options_for_select(%w{John Doe Jane })) %>
<%= link_to "Delete",
{ :controller => "myname", :action => "add",
:id => name },
2007 Jan 25
2
React on select_tag (onchange)
...I have the field, where I like to react directly.
...
<%= select_tag("rowsperpage", options_for_select( [[5, 5], [10,10],
[25,25], [50,50], [100,100],[200, 200],[500, 500],[1000, 1000]],
@rowsperpage ),
:onchange=>"alert(this.form.rowsperpage.options[this.form.rowsperpage.selectedIndex].value)"
) %>
...
The alert was only an example (I test it also with render, but without a
solution).
But I could change the values with no reaction.
What must I do, that the controller react direcly on my changes.
Thanks in advance.
Mike
--
Posted via http://www.ruby-forum.com/.
--~--...
2007 Jun 06
2
Getting ajax to update a select box after php mysql script is run.
Hi
I''ll get to it right away:
1. I have a simple page with a form, in this form there is a "select"
box with a number of options. On the right i also have a "input" field
with a submit option.
2. When the user puts something in the input field and hits submit, a
php script is run, that puts that entry in mysql table.
Question:
3. How do i with Ajax update the
2006 Jan 18
6
Autocomplete related fields
I have a table that has city, state and postal code. I want to
auto-fill the city and state when a postal code is entered.
The city and postal code are simple text fields, but the state is a
drop-down list with abbreviations as the value, and the full state
name as the option text.
I assume with Ajax.Updater I could just return the HTML for both the
city and state fields -- including the entire
2012 Oct 09
10
Auto refresh the drop-down
I have an option in dropdown like "Add new option" written using
grouped_collection_select.
And when user clicks on the "Add new option". A pop up dialog appears to
add a new value. And when I click create it hits the database and adds the
value to the db.
But It never updates the dropdown list. Suggest me a way to auto refresh
only the current dropdown with the new
2006 Aug 08
2
Javascript - multiple select selectboxes
...107";
</SCRIPT>
</head>
<body>
<form name="addCodes" action="test/update" method="post">
<select name="Division" size="1"
onchange="setOptions(document.addCodes.Division.options[document.addCodes.Division.selectedIndex].value);">
<option value="00">Autos</option>
<option value="01">Bobcats</option>
</select>
<select name="codes" size="10" multiple>
</select>
<input type="submit" value...