Welcome Guest, Not a member yet? Register   Sign In
Validation with redirect?
#1

[eluser]fakeempire[/eluser]
Hey guys -- I have a form I'm trying to use validation on but the form is dynamic.

http://sitename/event/register/<?= $event_id ?>

The form view pulls event specific stuff from the database depending on the event_id (title, date, description, etc). So there is not an actual 'form' view.

So if validation fails I cannot just
Code:
$this->view->load('form');
because I need to pass something more along the lines of
Code:
$this->view->load('form/<?= $event_id ?>')
which obviously doesnt work. I'm having to use a redirect
Code:
$this->validation->set_rules($rules);
    
      if ($this->validation->run() == FALSE)
      {
        redirect('/event/register/' . $event_id, 'refresh');
      }
But redirect doesn't pass the validation errors (or any variables for that matter (AFAIK)).
Could anyone shed some light on this for me? A possible solution or let me know if I going about this the wrong way.

Many thanks -
.adam.
#2

[eluser]Craig A Rodway[/eluser]
You could set the event ID as a hidden field in the form, and use this to check which form to load on the re-validation.
#3

[eluser]Huan[/eluser]
I agreed with Craig




Theme © iAndrew 2016 - Forum software by © MyBB