Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 680817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:24:52+00:00 2026-05-14T01:24:52+00:00

I am implementing jQuery tabs on mysite, one of the tabs holds a form

  • 0

I am implementing jQuery tabs on mysite, one of the tabs holds a form and this is my problem, the form is loaded in via ajax as it is used multiple time throughout the site. My issue is that when the form is submitted the page leaves the tabbed area, whereas I need to stay within the tabbed system.

Below is the code I am using

TABS HTML

<div id="tabs">
                <ul>
                    <li><a href="#tabs-1">Active Categories</a></li>
                    <li><a href="#tabs-2">De-activated Categories</a></li>
                    <li><a href="<?=base_url();?>admin/addCategory">Add A New Category</a></li>
                </ul>

FORM MARKUP

 <div id="contact_form">
<?php
    // open the form
    echo form_open(base_url().'admin/addCategory');
        // categoryTitle
        echo form_label('Category Name', 'categoryTitle');
        echo form_error('categoryTitle');
        $data = array(
            'name' => 'categoryTitle',
            'id' => 'categoryTitle',
            'value' => $categoryTitle,
        );
        echo form_input($data);


        // categoryAbstract
        $data = array(
            'name' => 'categoryAbstract',
            'id' => 'categoryAbstract wysiwyg',
            'value' => $categoryAbstract,
        );
        echo form_label('Category Abstract', 'categoryAbstract');
        echo form_error('categoryAbstract');
        echo form_textarea($data);
        // categorySlug
        $data = array(
            'name' => 'categorySlug',
            'id' => 'categorySlug',
            'value' => $categorySlug,
        );
        echo form_label('Category Slug', 'categorySlug');
        echo form_error('categorySlug');
        echo form_input($data);
        // categoryIsSpecial
        /*$data = array(
            'name' => 'categoryIsSpecial',
            'id' => 'categoryIsSpecial',
            'value' => '1',
            'checked' => $checkedSpecial,
        );
        echo form_label('Is Category Special?', 'categoryIsSpecial');
        echo form_error('categoryIsSpecial');
        echo form_checkbox($data);*/
        // categoryOnline
        $data = array(
            'name' => 'categoryOnline',
            'id' => 'categoryOnline',
            'value' => '1',
            'checked' => $checkedOnline,
        );
        echo form_label('Online?', 'categoryOnline');
        echo form_checkbox($data);
        echo form_error('categoryOnline');
        //hidden field check if we are adding or editing
        echo form_hidden('edit', $edit);
        echo form_hidden('categoryId', $categoryId);
        // categorySubmit
        $data = array('class' => 'submit', 'id' => 'submit', 'value'=>'Submit', 'name' => 'categorySubmit');
        echo form_submit($data);
        echo form_close();
    ?>
</div>

FORM PROCESS

function saveCategory() {
    $data = array();
        // we need to set the what element the form errors get displayed in
        $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
        // we need to estabilsh some rules so the form can be submitted without error,
        // or if there is error then the form needs show errors.
        $config = array(
                    array(
                        'field' => 'categoryTitle',
                        'label' => 'Category title',
                        'rules' => 'required|trim|max_length[25]|xss_clean'
                        ),
                    array(
                        'field' => 'categoryAbstract',
                        'label' => 'Category abstract',
                        'rules' => 'required|trim|max_length[150]|xss_clean'
                        ),
                    array(
                        'field' => 'categorySlug',
                        'label' => 'Category slug',
                        'rules' => 'required|trim|alpha|max_length[25]|xss_clean'
                        ),
                    /*array(
                        'field' => 'categoryIsSpecial',
                        'label' => 'Special category',
                        'rules' => 'trim|xss_clean'
                        ),*/
                    array(
                        'field' => 'categoryOnline',
                        'label' => 'Category online',
                        'rules' => 'trim|xss_clean'
                        )
                );
        $this->form_validation->set_rules($config);
        // with the validation rules set we can no run the validation rules over the form
        // if any the validation returns false then the error messages will be returned to the view
        // in the delimiters that we set further up the page.
        if($this->form_validation->run() == FALSE) {
            // we should reload the form
            $this->load->view('admin/add_category');
        } 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:24:52+00:00Added an answer on May 14, 2026 at 1:24 am

    you can use something like this… if you are using jquery ui tabs…

    $('.selector').tabs({ selected: <?=$_POST[selected]?$_POST[selected]:0?> });
    

    then your form, you must have something like,

    <input type="hidden" name="selected" value="2" /> // value=2 if you want third tab selected... 0 if first....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

recently, while implementing Ajax Jquery on one the my site, throw strange 401 UnAuthorised
I am implementing a jquery autocomplete on a search form and am getting the
I'm having trouble implementing this jQuery plugin for dynamic forms while following this tutorial
I'm currently implementing jQuery UI's autocomplete in my clients webshop. The problem is: the
I am implementing this JQuery UI multiselect from http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ I have managed to get
I'm having a little problem implementing some jQuery into a page I am doing.
I'm implementing this JQuery Lightbox plugin inside a DataList: http://leandrovieira.com/projects/jquery/lightbox/ I tested this code
I am implementing Location field in JS form using JSON,JQUERY state <select name=state id=state-list
I have my jQuery UI Tabs working right now but need help implementing the
I have my jQuery UI Tabs working right now but need help implementing the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.