Welcome Guest, Not a member yet? Register   Sign In
form validation, set_value and initial value
#1

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
Reply
#2

(This post was last modified: 07-22-2018, 04:52 AM by PaulD. Edit Reason: Slight typo )

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.
Reply
#3

Sure it helps ! Heedless was I, thanks !
Reply




Theme © iAndrew 2016 - Forum software by © MyBB