This is because cgi.params["numdomains"] will return a string. As a range can't be from a number to a string, you get the following problem: in irb: >> (0.."30") ArgumentError: bad value for range from (irb):1 What you need to do is run "to_i" on the string. unless cgi.params['numdomains'].empty? then $numdomains = cgi.params['numdomains'].to_i else $numdomains = 3 end That should fix your problem. Julian. Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO (#2) OUT NOW! http://sensei.zenunit.com/ On 03/04/2008, at 4:48 PM, Prabhas Gupte wrote: > I am writing an eruby script (rhtml). Depending on value of a > particular > variable, I display number of input boxes. > If that param is not passed, I am setting variable to some value. > It works fine for first time. But when I click on the link, used to > increase input fields, I get ArgumentError even if the variable is set > to proper value. > Here is the code snippet: > ------------------------------------------------- > ::: > > unless cgi.params['numdomains'].empty? then > $numdomains = cgi.params['numdomains'] > else > $numdomains = 3 > end > > ::::: > > for dcnt in 0...$numdomains > # code to disply input items > end > > ::: > -------------------------------------------------- > Do anyone have any idea, what may be going wrong? > -- > Posted via http://www.ruby-forum.com/. >