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?

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

On Thu, Mar 10, 2011 at 9:43 AM, Me [email protected] wrote:

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.

http://groups.google.com/group/rubyonrails-talk?hl=en.

On Thu, Mar 10, 2011 at 11:39 AM, Me [email protected] wrote:

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.

“Ruby on Rails: Talk” group.

http://groups.google.com/group/rubyonrails-talk?hl=en.

On Wednesday, March 9, 2011 9:55:34 PM UTC-6, jim wrote:

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 )
%>

On Wednesday, March 9, 2011 9:57:02 PM UTC-6, jim wrote:

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 )
%>

On Thu, Mar 10, 2011 at 11:39 AM, Me [email protected] wrote:

2.2.2. Anyway is there a way to send the value selected in a select menu to

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

On Thu, Mar 10, 2011 at 12:04 PM, Me [email protected] wrote:

   <%= excluded_date_attr.calendar_date_select :excluded_date, :class

) %>

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.

Groups “Ruby on Rails: Talk” group.

http://groups.google.com/group/rubyonrails-talk?hl=en.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

On Wed, Mar 9, 2011 at 10:55 PM, Me [email protected] wrote:

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs