![]() |
cannot user redirect() function.. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: cannot user redirect() function.. (/showthread.php?tid=61077) Pages:
1
2
|
cannot user redirect() function.. - El Forum - 09-12-2014 [eluser]scorpioniz[/eluser] cannot use redirect function after Code: $this->form_validation->run i have function: Code: function edit($id = NULL){ and if i put redirect before Code: if($this->form_validation->run('event/createedit') == FALSE) plz help.. also i notice that it tries to redirect where i need, but than it re-redirects to the edit page.. cannot user redirect() function.. - El Forum - 09-12-2014 [eluser]Tim Brownlaw[/eluser] That sounds like it's not "getting" there... So it's not being executed! What if you temporarily add just prior to the redirect ( or comment out the redirect ) with... Code: echo 'Hello - I am at line: '. __LINE__.'<br>'; You can plonk that echo statement ( without the exit) in your if's and else's to see where the code is going and where it isn't. The exit() just stops the script whizzing along... I use that all the time to quickly find out what's going on when things go "Strange"! cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]scorpioniz[/eluser] [quote author="Tim Brownlaw" date="1410581572"]That sounds like it's not "getting" there... So it's not being executed! What if you temporarily add just prior to the redirect ( or comment out the redirect ) with... Code: echo 'Hello - I am at line: '. __LINE__.'<br>'; You can plonk that echo statement ( without the exit) in your if's and else's to see where the code is going and where it isn't. The exit() just stops the script whizzing along... I use that all the time to quickly find out what's going on when things go "Strange"! [/quote] hm.. i was already trying with exit, and it's working.. .. my DB sql's also are working, but redirect just stops.. :// and i have notice that in chrome developer tools (F12) where is network section i see that it load my view of show.. and i see all the code inside of that link, but second one is again edit, and it loads it cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]Tim Brownlaw[/eluser] You have... Code: if($this->form_validation->run('event/createedit') == FALSE){ From the User Guide: $this->form_validation->run(); Runs the validation routines. Returns boolean TRUE on success and FALSE on failure. You can optionally pass the name of the validation group via the function, as described in: Saving Groups of Validation Rules to a Config File. So I'm unsure as to what you were intending by passing 'event/createedit' through it... It probably always returns FALSE! cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]scorpioniz[/eluser] [quote author="Tim Brownlaw" date="1410622090"]You have... Code: if($this->form_validation->run('event/createedit') == FALSE){ From the User Guide: $this->form_validation->run(); Runs the validation routines. Returns boolean TRUE on success and FALSE on failure. You can optionally pass the name of the validation group via the function, as described in: Saving Groups of Validation Rules to a Config File. So I'm unsure as to what you were intending by passing 'event/createedit' through it... It probably always returns FALSE! [/quote] If it always would return false, than it never would update or insert my sql's, and like i was saying in previous post it's doing it (update/insert to my DB), so it's not always returning false. and this funkcion is just for simple add/edit record to/on DB from simple form. if it's false, then it load's view, else - doing update/insert record to DB cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]Tim Brownlaw[/eluser] Well I was just curious if you had a validation rule array called event/createedit! Or there's something missing in the userguide I'm not aware of that simply ignores that or.... Anyway I don't have your code in front of me so I don't know if you put in yourdomain.com/user/event/show/1 ( assuming 1 is a valid id) works... Kind of running out of ideas here ![]() cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]scorpioniz[/eluser] [quote author="Tim Brownlaw" date="1410625216"]Well I was just curious if you had a validation rule array called event/createedit! Or there's something missing in the userguide I'm not aware of that simply ignores that or.... Anyway I don't have your code in front of me so I don't know if you put in yourdomain.com/user/event/show/1 ( assuming 1 is a valid id) works... Kind of running out of ideas here ![]() [/quote] that's i'm talking about.. because everywhere else redirect() function working fine.. but just not here.. :/ i am thinking maybe it's not enough time.. simetimes sleep helps.. sad that i do not have here that code, to try (on monday I will, unless i will find another solution). and about show page.. yes mydomain.com/user/event/show/1 is valid and opens page perfectly if i put my redirect before IF statement.. (actioly i didn't try to run redirect in if before ajaxValidation(); ) if you would see my code in first post there is commented line with redirect, and if I uncomment it and run it - it's redirecting to page perfectly.. :/ but not at the end of else statement.. :/// cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]Tim Brownlaw[/eluser] Well it seems we are all guilty at some stage of not reading everything that is posted! cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]InsiteFX[/eluser] Shouldn't you be using this to check and make sure you are getting an ajax request? Code: if ($this->input->is_ajax_request()) And as Tim mentioned it is very hard to help someone with out seeing the full code. cannot user redirect() function.. - El Forum - 09-13-2014 [eluser]InsiteFX[/eluser] Delete double post |