Forum: Ruby on Rails Question about observe_form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Af3cecc8af253b5acd3c09c5b67c0074?d=identicon&s=25 Valentino Lun (on9west)
on 2008-11-20 10:07
Dear all

I am writing a program that use observe_field to listen 1 field. The
code is as follow:

  <form name="sform" action="" style="display:inline;">
  <label for="item_name">Filter on Application Code  : </label>
  <%= text_field_tag('appcode', params['appcode'], :size => 10 ) %>
  </form>

  <%= observe_field 'app_code',
           :frequency => 2,
           :update => 'table',
           :url => {:action => :index},
           :with => 'appcode' %>

I would like to enhance this to listen more than 1 fields, I try below
code

  <form name="sform" action="" style="display:inline;">
  <label for="item_name">Filter on Hospital Code  : </label>
  <%= text_field_tag('hospcode', params['hospcode'], :size => 10 ) %>
<br>
  <label for="item_name">Filter on Application Code  : </label>
  <%= text_field_tag('appcode', params['appcode'], :size => 10 ) %>
  </form>

  <%= observe_field 'appcode',
           :frequency => 2,
           :update => 'table',
           :url => {:action => :index},
           :with => 'appcode' %>

  <%= observe_field 'hospcode',
           :frequency => 2,
           :update => 'table',
           :url => {:action => :index},
           :with => 'hospcode' %>

It seems not a clever approach, could you give me some hint on that?

Thank you very much.

Valentino
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-20 10:19
(Received via mailing list)
On 20 Nov 2008, at 09:07, Valentino Lun wrote:

>  <label for="item_name">Filter on Application Code  : </label>
>           :frequency => 2,
>           :update => 'table',
>           :url => {:action => :index},
>           :with => 'hospcode' %>
>
> It seems not a clever approach, could you give me some hint on that?
>
observe_form ?

Fred
Af3cecc8af253b5acd3c09c5b67c0074?d=identicon&s=25 Valentino Lun (on9west)
on 2008-11-20 10:21
Frederick Cheung wrote:
> On 20 Nov 2008, at 09:07, Valentino Lun wrote:
>
>>  <label for="item_name">Filter on Application Code  : </label>
>>           :frequency => 2,
>>           :update => 'table',
>>           :url => {:action => :index},
>>           :with => 'hospcode' %>
>>
>> It seems not a clever approach, could you give me some hint on that?
>>
> observe_form ?
>
> Fred

Hello

I tried below code, but seems not working..

  <%= observe_form 'sform',
           :frequency => 2,
           :update => 'table',
           :url => {:action => :index},
           :submit => 'sform' %>

Please help. Thanks
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-20 10:23
(Received via mailing list)
On 20 Nov 2008, at 09:21, Valentino Lun wrote:

>>> It seems not a clever approach, could you give me some hint on that?
>           :frequency => 2,
>           :update => 'table',
>           :url => {:action => :index},
>           :submit => 'sform' %>
>

Define not working. (but as a guess, your form doesn't have an id)

Fred
Af3cecc8af253b5acd3c09c5b67c0074?d=identicon&s=25 Valentino Lun (on9west)
on 2008-11-20 11:05
Frederick Cheung wrote:
> On 20 Nov 2008, at 09:21, Valentino Lun wrote:
>
>>>> It seems not a clever approach, could you give me some hint on that?
>>           :frequency => 2,
>>           :update => 'table',
>>           :url => {:action => :index},
>>           :submit => 'sform' %>
>>
>
> Define not working. (but as a guess, your form doesn't have an id)
>
> Fred

Thank for your help. The problem is solved.
This topic is locked and can not be replied to.