JS data to rails view helper

I have a view helper like ryan bates complex forms task helper, rails 2.2.2. Anyway is there a way to send the value selected in a select menu to the helper? I am trying to do stuff without going back to the server.

<%= select_tag :discout_code, options_for_select(@discount_codes)%><%= add_exclusion_date_link(‘Add Existing’, JS ) %>

http://railscasts.com/episodes/88-dynamic-select-menus

Ya I have seen that. How does that apply to what I am doing?

I have a view helper like ryan bates complex forms task helper, rails 2.2.2. Anyway is there a way to send the value selected in a select menu to the helper? I am trying to do stuff without going back to the server.

if you’re trying to use the value selected by the user in your helper through js, you can’t.

js is client side, helpers are server side.

Ok, is there another way to get this to work without going back to the server to just get a value from the select?

Ok, is there another way to get this to work without going back to the server to just get a value from the select?

I have a view helper like ryan bates complex forms task helper, rails 2.2.2. Anyway is there a way to send the value selected in a select menu to the helper? I am trying to do stuff without going back to the server.

if you’re trying to use the value selected by the user in your helper through js, you can’t.

js is client side, helpers are server side.

<%= select_tag :discout_code, options_for_select(@discount_codes)%><%= add_exclusion_date_link(‘Add Existing’, JS ) %>

You received this message because you are subscribed to the Google Groups “Ruby on Rails: Talk” group.

To post to this group, send email to rubyonra...@googlegroups.com.

To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

visit my blog at http://jimlabs.heroku.com

You received this message because you are subscribed to the Google Groups “Ruby on Rails: Talk” group.

To post to this group, send email to rubyonrails-talk@googlegroups.com.

To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ok, is there another way to get this to work without going back to the server to just get a value from the select?

please don’t top post.

what are you trying to achieve? give use some code snippets.

Not sure where to put this but here is the code again:

<%= select_tag :discount_code, options_for_select(@discount_
codes)%><%= add_exclusion_date_link(‘Add Existing’, Select Value goes here ) %>

Ok, is there another way to get this to work without going back to the server to just get a value from the select?

please don’t top post.

what are you trying to achieve? give use some code snippets.

  Here is the partial:
  <div class="form_field code-column  ">

<% fields_for_exclusion_date(excluded_date) do |excluded_date_attr| %>
<%= excluded_date_attr.label :exclusion_date,‘Excluded Date:’ -%>
<%= excluded_date_attr.calendar_date_select :excluded_date, :class => “valid_from_date-input text-input”,:value => value %>
<%= link_to_function “remove”, “$(this).up(’.form_field’).remove()” %>
<% end %>

Here is the view:
<%= select_tag :discout_code, options_for_select(@discount_

codes)%><%= add_exclusion_date_link(‘Add Existing’, Select value goes here ) %>

Ok, is there another way to get this to work without going back to the server to just get a value from the select?

please don’t top post.

what are you trying to achieve? give use some code snippets.

  Here is the partial:
  <div class="form_field code-column  ">

<% fields_for_exclusion_date(excluded_date) do |excluded_date_attr| %>

<%= excluded_date_attr.label :exclusion_date,'Excluded Date:' -%>
   <%= excluded_date_attr.calendar_date_select :excluded_date, :class => "valid_from_date-input text-input",:value => value %>

  <%= link_to_function "remove", "$(this).up('.form_field').remove()" %>
<% end %>
Here is the view:

<%= select_tag :discout_code, options_for_select(@discount_

codes)%><%= add_exclusion_date_link(‘Add Existing’, Select value goes here ) %>

try updating the value attribute of the line that uses calendar_date_select via js? so always render the partial

but on change of select value, update the value attribute.

grab the input:select with jquery, is easy, the video shows a bit about dealing with selects, after that

$.ajax{

type: ‘POST’,

url: ‘controller/action’

data : { value: ‘grab it from the element’},

success: jadah , jadah, jadah

error: jadah , jadah, jadah

}

set the route for the action

create an action that responds to XHR

if you have any problem traversing the html paste some html output to see if i can help you grab the element