Forum: Ruby on Rails textfield and params

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
sayoyo (Guest)
on 2005-11-29 19:02
(Received via mailing list)

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" 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


Start your day with Yahoo! - Make it your home page!
dba (Guest)
on 2005-11-30 02: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

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; }
// -->
<form name="Composer" id="Composer" method="post" ...>
<a href="javascript:submitAction('h2t')">link</a>
This topic is locked and can not be replied to.