CodeIgniter Forums

Full Version: form validation, set_value and initial value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
It seems impossible to set initial value to a form field when you need to use set_value() function to repopulate the form field with the submitted data, Am I wrong ?
"Placeholder" might be a solution to suggest something to the end-user but when it comes to "date", setting initial value to date-of-the day is so comfortable ...
Help and / or explanations will be apreciated.
Thanks,
Eric
You are wrong  Smile

In the docs:
https://www.codeigniter.com/user_guide/h...#set_value

You would set a value like this:
PHP Code:
<input type="text" name="quantity" value="<?php echo set_value('quantity', '26'); ?>" size="50" /> 

This would set a default value of 26 to the input field.

I hope that helps,

Paul

PS The docs are excellent - they are worth reading in detail.
Sure it helps ! Heedless was I, thanks !