I have been trying to pass a collection_select parameter and a text field
parameter to observe_field so that it watches both the parameters
simultaneously.
but what i can see is , when i select some value from drop down and dont
write anything in text field its giving correct results.parameters are also
correct passed, but just after that if i write something in text field that
value also get passed as collection_select parameter(labtid in my case)
my view code is:
<form name="sform" id="myform" action=""
style="display:inline;">
<br/>
<label for="dev_name">Filter on Device Name : </label>
<%= text_field_tag("query", params[''query''],
:size => 10 )%>
<label>Lab : </label>
<%= collection_select(:labt, :labtid,
@labs, :id, :name,:prompt => "Select a
Lab") %>
</form>
<%= image_tag("spinner.gif",
:align => "absmiddle",
:border => 0,
:id => "spinner",
:style =>"display: none;" ) %>
</p>
<%= javascript_include_tag :defaults %>
<%= observe_field ''query'', :frequency => 2,
:update => "table",
:before => "Element.show(''spinner'')",
:success => "Element.hide(''spinner'')",
:url => {:action => ''trial_location1''},
:with => "''labtid='' +
value+''&query=''+escape($(''query'').value)"
%>
<%= observe_field ''labt_labtid'', :frequency => 2,
:update => "table",
:before => "Element.show(''spinner'')",
:success => "Element.hide(''spinner'')",
:url => {:action => ''trial_location1''},
:with => "''labtid='' +
value+''&query=''+escape($(''query'').value)"
%>
<div id="table">
<%= render :partial => "devices_list" %>
</div>
i believe the problem lies with :with parameter.
Can someone suggest me the problem?
Thanking in advance!!
--
View this message in context:
http://www.nabble.com/observe_field-tp18009235p18009235.html
Sent from the RubyOnRails Users mailing list archive at Nabble.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 19 Jun 2008, at 14:38, sup wrote:> > > I have been trying to pass a collection_select parameter and a text > field > parameter to observe_field so that it watches both the parameters > simultaneously. > > but what i can see is , when i select some value from drop down and > dont > write anything in text field its giving correct results.parameters > are also > correct passed, but just after that if i write something in text > field that > value also get passed as collection_select parameter(labtid in my > case) > my view code is: > > <%= observe_field ''query'', :frequency => 2, > :update => "table", > :before => "Element.show(''spinner'')", > :success => "Element.hide(''spinner'')", > :url => {:action => ''trial_location1''}, > :with => "''labtid='' + value+''&query=''+escape($ > (''query'').value)" %>In the context of an observe_field, value is the value of the observed field (so $(''query'').value in this case, and $(''labt_labtid'') in the other, so you need to swap things around in the above observe_form (the other one is fine) Might observe_form not be less hassle in this case ? Fred> <%= observe_field ''labt_labtid'', :frequency => 2, > :update => "table", > :before => "Element.show(''spinner'')", > :success => "Element.hide(''spinner'')", > :url => {:action => ''trial_location1''}, > > :with => "''labtid='' + value+''&query=''+escape($ > (''query'').value)" > > %> > > > <div id="table"> > <%= render :partial => "devices_list" %> > </div> > > i believe the problem lies with :with parameter. > Can someone suggest me the problem? > Thanking in advance!! > -- > View this message in context: http://www.nabble.com/observe_field-tp18009235p18009235.html > Sent from the RubyOnRails Users mailing list archive at Nabble.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
u mean it should be like this ?
:with => "''labt_labtid='' +
value+''&query=''+escape($(''query'').value)"
On Thu, Jun 19, 2008 at 7:17 PM, Frederick Cheung <
frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
> On 19 Jun 2008, at 14:38, sup wrote:
>
> >
> >
> > I have been trying to pass a collection_select parameter and a text
> > field
> > parameter to observe_field so that it watches both the parameters
> > simultaneously.
> >
> > but what i can see is , when i select some value from drop down and
> > dont
> > write anything in text field its giving correct results.parameters
> > are also
> > correct passed, but just after that if i write something in text
> > field that
> > value also get passed as collection_select parameter(labtid in my
> > case)
> > my view code is:
> >
> > <%= observe_field ''query'', :frequency => 2,
> > :update => "table",
> > :before =>
"Element.show(''spinner'')",
> > :success =>
"Element.hide(''spinner'')",
> > :url => {:action =>
''trial_location1''},
> > :with => "''labtid='' +
value+''&query=''+escape($
> > (''query'').value)" %>
> In the context of an observe_field, value is the value of the observed
> field (so $(''query'').value in this case, and
$(''labt_labtid'') in the
> other, so you need to swap things around in the above observe_form
> (the other one is fine)
> Might observe_form not be less hassle in this case ?
>
> Fred
>
>
> > <%= observe_field ''labt_labtid'', :frequency
=> 2,
> > :update => "table",
> > :before =>
"Element.show(''spinner'')",
> > :success =>
"Element.hide(''spinner'')",
> > :url => {:action =>
''trial_location1''},
> >
> > :with => "''labtid='' +
value+''&query=''+escape($
> > (''query'').value)"
> >
> > %>
> >
> >
> > <div id="table">
> > <%= render :partial => "devices_list" %>
> > </div>
> >
> > i believe the problem lies with :with parameter.
> > Can someone suggest me the problem?
> > Thanking in advance!!
> > --
> > View this message in context:
> http://www.nabble.com/observe_field-tp18009235p18009235.html
> > Sent from the RubyOnRails Users mailing list archive at Nabble.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On 19 Jun 2008, at 14:55, supriya agarwal wrote:> u mean it should be like this ? > :with => "''labt_labtid='' + value+''&query=''+escape($(''query'').value)"the observe field on labt_labtid should be like that, but not the other one (again, it might be easier to have a single observe form) Fred> > > > On Thu, Jun 19, 2008 at 7:17 PM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > wrote: > > > On 19 Jun 2008, at 14:38, sup wrote: > > > > > > > I have been trying to pass a collection_select parameter and a text > > field > > parameter to observe_field so that it watches both the parameters > > simultaneously. > > > > but what i can see is , when i select some value from drop down and > > dont > > write anything in text field its giving correct results.parameters > > are also > > correct passed, but just after that if i write something in text > > field that > > value also get passed as collection_select parameter(labtid in my > > case) > > my view code is: > > > > <%= observe_field ''query'', :frequency => 2, > > :update => "table", > > :before => "Element.show(''spinner'')", > > :success => "Element.hide(''spinner'')", > > :url => {:action => ''trial_location1''}, > > :with => "''labtid='' + value+''&query=''+escape($ > > (''query'').value)" %> > In the context of an observe_field, value is the value of the observed > field (so $(''query'').value in this case, and $(''labt_labtid'') in the > other, so you need to swap things around in the above observe_form > (the other one is fine) > Might observe_form not be less hassle in this case ? > > Fred > > > > <%= observe_field ''labt_labtid'', :frequency => 2, > > :update => "table", > > :before => "Element.show(''spinner'')", > > :success => "Element.hide(''spinner'')", > > :url => {:action => ''trial_location1''}, > > > > :with => "''labtid='' + value+''&query=''+escape($ > > (''query'').value)" > > > > %> > > > > > > <div id="table"> > > <%= render :partial => "devices_list" %> > > </div> > > > > i believe the problem lies with :with parameter. > > Can someone suggest me the problem? > > Thanking in advance!! > > -- > > View this message in context: http://www.nabble.com/observe_field-tp18009235p18009235.html > > Sent from the RubyOnRails Users mailing list archive at Nabble.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i tried doing it this way.. its working fine.. also i think i should tell you that in my controller im accessing labtid as params[:labtid] . i tried putting params[:labt][:labtid] but then it completely failed. can you help me here?? it would be great if you could put some sample code for observe_form . i have no clue how it should work.! Thanks again alot! On Thu, Jun 19, 2008 at 7:39 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 19 Jun 2008, at 14:55, supriya agarwal wrote: > > > u mean it should be like this ? > > :with => "''labt_labtid='' + value+''&query=''+escape($(''query'').value)" > > the observe field on labt_labtid should be like that, but not the > other one (again, it might be easier to have a single observe form) > > Fred > > > > > > > > On Thu, Jun 19, 2008 at 7:17 PM, Frederick Cheung < > frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > wrote: > > > > > > On 19 Jun 2008, at 14:38, sup wrote: > > > > > > > > > > > I have been trying to pass a collection_select parameter and a text > > > field > > > parameter to observe_field so that it watches both the parameters > > > simultaneously. > > > > > > but what i can see is , when i select some value from drop down and > > > dont > > > write anything in text field its giving correct results.parameters > > > are also > > > correct passed, but just after that if i write something in text > > > field that > > > value also get passed as collection_select parameter(labtid in my > > > case) > > > my view code is: > > > > > > <%= observe_field ''query'', :frequency => 2, > > > :update => "table", > > > :before => "Element.show(''spinner'')", > > > :success => "Element.hide(''spinner'')", > > > :url => {:action => ''trial_location1''}, > > > :with => "''labtid='' + value+''&query=''+escape($ > > > (''query'').value)" %> > > In the context of an observe_field, value is the value of the observed > > field (so $(''query'').value in this case, and $(''labt_labtid'') in the > > other, so you need to swap things around in the above observe_form > > (the other one is fine) > > Might observe_form not be less hassle in this case ? > > > > Fred > > > > > > > <%= observe_field ''labt_labtid'', :frequency => 2, > > > :update => "table", > > > :before => "Element.show(''spinner'')", > > > :success => "Element.hide(''spinner'')", > > > :url => {:action => ''trial_location1''}, > > > > > > :with => "''labtid='' + value+''&query=''+escape($ > > > (''query'').value)" > > > > > > %> > > > > > > > > > <div id="table"> > > > <%= render :partial => "devices_list" %> > > > </div> > > > > > > i believe the problem lies with :with parameter. > > > Can someone suggest me the problem? > > > Thanking in advance!! > > > -- > > > View this message in context: > http://www.nabble.com/observe_field-tp18009235p18009235.html > > > Sent from the RubyOnRails Users mailing list archive at Nabble.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 20, 5:59 am, "supriya agarwal" <supriya.ii...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> i tried doing it this way.. its working fine.. > also i think i should tell you that in my controller im accessing labtid as > params[:labtid] . > i tried putting params[:labt][:labtid] but then it completely failed. >You need to name the parameter labt[labtid] in your :with option if you want to be able to access it as params[:labt][:labtid] as you do when it''s submitted ''normally''> can you help me here?? it would be great if you could put some sample code > for observe_form . i have no clue how it should work.! >It''s just like observe_field except you give it a form and it will submit the whole form whenever any of it changes. Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---