Problems with form validation/form helper and re-populate |
[eluser]albertone01[/eluser]
Hello this is my controller: Code: function index() and this is my view: Code: <?php echo form_open('/Myview/index/'); ?> The first time it's all right, i can see correctly the values "Example" in the name input. If I submit the form i get this error over all my input form: Code: Severity: Notice why??? help ![]()
[eluser]Dam1an[/eluser]
You need to pass the $data rray into the view the second time as well like this Code: if ($this->form_validation->run() == FALSE){
[eluser]albertone01[/eluser]
But in this way i have to put all post data into $data var... I would to repopulate the form in this way: http://ellislab.com/codeigniter/user-gui...latingform ...
[eluser]Dam1an[/eluser]
Right, now I'm with you (not thinking straight today) Even if it doesn't need the second value, it still looks for it, changing the view to this fixes the problem Code: <?php echo form_open('test/index'); ?> another solution would be to always initialise these to nothing in the controller and pass them in
[eluser]albertone01[/eluser]
Ok, now i don't have the error .... But I have not the posted value, I have 'noting' or '' ... ![]()
[eluser]Dam1an[/eluser]
You're just one problem after another ![]() Out of curiosity, why do you need to set the default as a variable? Won't it always be the same? So it could be hard coded
[eluser]albertone01[/eluser]
'Couse I need to purpose to users some data, but they are free to change them... Ex. The user open the form: - name*: '' - surname*: '' - date*: 25/05/2009 Change: - name* = 'Alberto' - surname*: '' - date*: 28/06/2009 I check that che surname is empty Return to the form with the new values... ![]() |
Welcome Guest, Not a member yet? Register Sign In |