Welcome Guest, Not a member yet? Register   Sign In
can I provided sample data in input value and still repopulate the field if validation failes
#1

[eluser]Flying Fish[/eluser]
I would like to provide a default value as an example of what a the user should enter in a few input fields.

something like
Code:
<input value='Enter your date here.' />

But I would also like the form to repopulate with any user entered data if they submit the form and don't pass validation.

I'm using
Code:
set_value('field_name')
to accomplish the repopulation.

Any thoughts on how to provide a default value in addition to this?

I guess I could use
Code:
if($_POST['field_name']) { }

instead of set_value(), but I was wondering if there is a more snappy codeigniter way to accomplish this

Thanks
#2

[eluser]pistolPete[/eluser]
User guide:

Quote:set_value()

Permits you to set the value of an input form or textarea. You must supply the field name via the first parameter of the function.
The second (optional) parameter allows you to set a default value for the form.
#3

[eluser]Flying Fish[/eluser]
perfect!

sorry I missed that in the documentation




Theme © iAndrew 2016 - Forum software by © MyBB