How to redirect on form validation succes? |
[eluser]123wesweat[/eluser]
Hi, Can't get a simple redirect to work in controllers/welcome.php i added a process function (which is called from part of Code: function register() { Or should i redirect to a view, like views/success.php? I still see the form?? regards,
[eluser]gigas10[/eluser]
Code: function process() { I believe this will work, adding the 'location' parameter in the redirect function is the only thing I did.
[eluser]123wesweat[/eluser]
hmm, tx but that didn't work. in welcome.php i added Code: function success(){ so now i am testing with Code: function process() {
[eluser]gigas10[/eluser]
hmm correct me if I'm wrong but isn't the validation class call form_validation? Code: function process() { I don't know if you redid the form_validation class or something, but at least that is what sticks out to me.
[eluser]123wesweat[/eluser]
hmm, the validation part in combo with jquery works fine. And like i said if i put some text in both fields. It will validate and i see the save data with firebug. - But the http request or CI redirect function isn't being executed. - With firebug i do see the success.php source code as a post request - I also see a get request but this doesn't load any response?? Maybe the way i am using the load->view is incorrect?? welcome/register: loads the form in a container, with Code: $this->data = array( welcome/process: process the form and on success should load welcome/success btw: i use libraries/validition and not libraries/Form_validation
[eluser]123wesweat[/eluser]
hmm i think this could be part of my probllem Code: <?=form_open("/welcome/process", 'onsubmit="return false;" id="form"')?> if i remove the return false; the form gets submitted when all fiels are not empty. But now when one of the fields isn't empty the jquery errors don't work.
[eluser]kgill[/eluser]
Quick question, since you're blocking submit in the form tag how's the form being submitted, is it via AJAX so that the process function is called in the background or do you do a submit via JS and it sends the browser to the welcome/process page?
[eluser]Dyllon[/eluser]
It sounds like you're posting a form with AJAX so that request is in the background which means your trying to redirect the AJAX call. If you wish to redirect after the form is submitted with AJAX you'll need to do it with the javascript. Some more details on how you are submitting the form would probably clear up the confusion.
[eluser]Dyllon[/eluser]
As a side note the validation class is deprecated as of CI 1.7.0 http://ellislab.com/codeigniter/user-gui...ation.html
[eluser]123wesweat[/eluser]
ok, i have this demo.js Code: $(document).ready(function() { Code: [removed][removed] I got a bit lazy and i used http://formtorch.geekhut.org/ ps: i notice i am using the validation library but it's recommended to use form_validation http://www.codeignitor.com/user_guide/li...ation.html |
Welcome Guest, Not a member yet? Register Sign In |