Welcome Guest, Not a member yet? Register   Sign In
Repopulation form fields with method GET
#1

[eluser]Mr.Data[/eluser]
Hello!
In my HTML code I create a form element with the code
Code:
form_open('url', array('method' => 'get'))
and I want codeigniter to repopulate the fields after submitting the form. However, it isn't working when using the method GET. If I delete the array so that POST is used everything works fine. Why is that so and how do I change that behaviour?
#2

[eluser]Mr.Data[/eluser]
Come on, has no one of you ever used a get form in your homepage?
#3

[eluser]Matalina[/eluser]
What's the view look like? need more code to help see the problem.
#4

[eluser]Aken[/eluser]
If you're using the form helpers like set_value() to repopulate your form, they default to the POST array only. You'd have to create your own functions, or pull from the GET array directly using $this->input->get() (and appropriate security checks).
#5

[eluser]Mr.Data[/eluser]
Damn, that's bad. Isn't there a way to fill the post array manually with everything from the get array so that the form helper methods still can be used?
#6

[eluser]Mr.Data[/eluser]
OK, I think I will use last parameter of the former helper methods which let you select the default value.
#7

[eluser]Aken[/eluser]
There's no point in using set_value() if you're only going to use the default value portion of it. Just check $this->input->value(), sanitize it, then pass it to your view, and echo it out.




Theme © iAndrew 2016 - Forum software by © MyBB