Need default value for my input element when there is no desired param

Hi,
In my form I set a default value as “enter text” for my text box.
In case of validation failure i am rendering the form, where i loss
the user entered text (instead the default value is appearing in the
text box). So, i need to set the default value only when there is no
particular param. How could i get this? Any one Please…

Thanks,
-Sadeesh kumar.

Depends on how you handle the data.

params[:field] ||= “default”
will set params[:field] to “default” if it’s nil, leave it as is, if
it has a value

Hi Thorsten,
Now I got it.

Thanks,
-Sadeesh kumar.