[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

multipart forms and cgi

Martin Stannard

12/3/2003 2:35:00 AM

Hi,

I'm having some trouble getting hidden fields to appear in multipart forms
working using cgi and mod_ruby.

ruby 1.8.1 (2003-10-31) [i686-linux]
apache 2.0.40
mod_ruby 1.1.1

I'm creating a multipart form using cgi.multipart_form("sub.rhtml") { ... }
to generate the following html:

<FORM METHOD="post" ENCTYPE="multipart/form-data" ACTION="sub.rhtml">
<P>
<INPUT NAME="privacy" SIZE="40" TYPE="text">
</P>
<BR>
<P>
Main Menu Mpeg:
<INPUT NAME="mpeg" SIZE="" MAXLENGTH="50" TYPE="file">
</P>
<INPUT NAME="formname" TYPE="hidden" VALUE="testform">
<INPUT TYPE="submit" VALUE="Save">
</FORM>


but when I try to retrieve the value of the field like this:

cgi.params['formname'][0]

there doesn't seem to be formname parameter.

This is the CGI.escape(cgi.inspect) string from the webbrowser (sorry
about the guff - the browser wouldn't display the straight inspected
output):

%23%3CCGI%3A0x84bc59c+%40cookies%3D%7B%7D%2C+%40output_cookies%3Dnil%2C+%40multipart%3Dtrue%2C+%40output_hidden%3Dnil%2C+%40params%3D%7B%22privacy%22%3D%3E%5B%23%3CStringIO%3A0x84bc358%3E%5D%7D%3E

I can see the privacy StringIO in there but not 'formname'. Hidden fields
seem to work on normal forms. Any ideas?

On a related note the std-lib documentation has a multipart? method for
CGI:QueryExtension but this doesn't seem to be in the version of cgi I've
got. Is there a later version?

regards,

Martin