Forum: Ruby on Rails textfield and params

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.
14b7344777a56ac9a1fad849f5d6da2a?d=identicon&s=25 sayoyo (Guest)
on 2005-11-29 18:02
(Received via mailing list)
Hi,

I have a question about getting the data from a
textfield. Normally, I put a textfield inside of a
form, and when a click on the button associated to the
form, the data written inside the textfield is sent to
the variable "Params" and I can get it from there.

However, now I have click on a link outside of the
form which contains the textfield. and the data of the
textfield is not sent to "params"..so I have not idea
how to get it.... I'm not really sure, it is a ruby
question or a normal html question.... Does anyone has
any idea????

Thanks you very much

sayoyo



__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
B9f28a2235697025ebfcebb81575a6b8?d=identicon&s=25 dba (Guest)
on 2005-11-30 01:51
(Received via mailing list)
Your link generates an http GET request, and what you want is a POST
request, generated from within a form. The GET request does not send the
data from the form. (thought you could use a <form method="get" ...>)

In the past I have used the link to trigger a JavaScript function to
submit your form. Here's a nasty snippet. Probably there is something
classier in the prototype library?

Hope it helps! --Allen

<script>
<!--
function submitAction(action) {
   var dml=document.Composer;
   var len = dml.elements.length;
   var i=0;
   for( i=0 ; i<len ; i++) {
     if (dml.elements[i].name=='a') { dml.elements[i].value=action; }
   }
   document.Composer.submit();
}
// -->
</script>
...
<form name="Composer" id="Composer" method="post" ...>
<a href="javascript:submitAction('h2t')">link</a>
This topic is locked and can not be replied to.