Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2668

fill form when collection_select is changed

From Edgars Liepa <exedzy@gmail.com>
Newsgroups comp.lang.ruby
Subject fill form when collection_select is changed
Date Tue, 12 Apr 2011 03:14:58 -0500
Organization Service de news de lacave.net
Lines 32
Message-ID <81ba95d8585a1c4f9fc82339c6ea5fe6@ruby-forum.com> (permalink)
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1302596161 85579 65.111.164.187 (12 Apr 2011 08:16:01 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Tue, 12 Apr 2011 08:16:01 +0000 (UTC)
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 381332
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <81ba95d8585a1c4f9fc82339c6ea5fe6@ruby-forum.com>
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!talisker.lacave.net!lacave.net!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:2668

Show key headers only | View raw


Hey there. :)
I have a problem.
I have collection_select, witch takes values from DB
I need to run fill textboxes from other table in DB, when
collection_select is selected.. can anyone tell me how can i make this
run function when collection_select is changed, cos my code is not
working..
And i have jquery in my ruby on rails project, so thats ok..

my code:

<script type="text/javascript">

        function fill_form(a)
            $.getJSON('/sticks/' + a.id + '.json', function(data) {
              var items = [];

              $.each(data, function(key, val) {
              alert(key + ': ' + val)
              };
            */
            }
          }
        </script>
        <%= f.label :stick_type %>
        <%= h.collection_select :stick_id, Stick.all, :id, :stick_type,
:prompt => "Select Stick", :onchange => "fill_form(this)" %>
        <br />

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | Next | Find similar | Unroll thread


Thread

fill form when collection_select is changed Edgars Liepa <exedzy@gmail.com> - 2011-04-12 03:14 -0500

csiph-web