Welcome Guest, Not a member yet? Register   Sign In
form generation library - how to display success message?


I'm using form generation library to create forms.
Everyting is fine except one thing.

I have a form:
    ->hidden('module', 0)
    ->hidden('join_lang', 'pl')
    ->text('join_name', 'Nazwa kategorii', 'required|trim|xss_clean')
    ->text('join_link', 'Slug', 'required|trim|xss_clean')
    ->select('id_parent', $select_cat, 'Rodzic')
    ->text('ordr', 'Kolejność', 'numeric|trim|xss_clean')
    ->textarea('join_text', 'Opis', 'trim|xss_clean')
    ->textarea('join_meta_title', 'Meta title', 'trim|xss_clean')
    ->textarea('join_meta_keywords', 'Meta keywords', 'trim|xss_clean')
    ->textarea('join_meta_description', 'Meta description', 'trim|xss_clean')
    ->model('Category', 'add_new')
    ->submit('Dodaj kategorię')
    ->onsuccess('redirect', 'categories');

$data['category_add_form'] = $this->form->get();
$data['errors'] = $this->form->errors;

$this->load->view('test', $data);

Now onsuccess its redirect to the categories page, but what I would like is to
not to redirect, stay on the same page and display success message above the form
(something like errors but for example in green color).

My question is how to do this?


You can use session flashdata to store a message when validation passes and in your view check to see if it exists and if it does, display it.

Works perfect!
Many thanks.

Theme © iAndrew 2016 - Forum software by © MyBB