From: carl mcdade Date: 2006-07-25T22:40:49+09:00 Subject: How to verify cgi.params values? ------=_Part_94141_4785837.1153834846899 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi I am running Ruby as CGI and have a form that returns a simple string. The porblem I am having is that if nothing is entered in the form the use of .empty does not work. There must be a carriage return or a space left behind that empty picks up. How do I get remove this? I have tried profession = cgi.params['profession'].strip but only get a CGI 500 error. Welcome to eruby Test

eRuby test

<% # Require the CGI library require 'cgi' # New CGI object cgi = CGI.new # prepare trap for form variables username = cgi.params['username'] profession = cgi.params['profession'] %>
Please enter your username:
Please enter your profession:
<% if username.empty? # Print out the form asking for the username %>

Please test my first eRuby application by entering your name in the text box.

<% else %> Thanks, <%= username %>!
<% if profession.empty? %>

So you are unemployed? Don't worry learn eRuby and you will have a job in no time.

<% else %> <%= profession %> sounds like a fun profession. <% end %> <% end %> ------=_Part_94141_4785837.1153834846899--