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

  • Home
  • SEARCH
  • 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 7401609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:31:08+00:00 2026-05-29T04:31:08+00:00

I have a view called volunteer_edit. Within volunteer_edit, I use jQuery to loop through

  • 0

I have a view called volunteer_edit. Within volunteer_edit, I use jQuery to loop through an array of project ID’s and, for each project ID, create a tab. The jQuery tabs plugin turns each link within an unordered list item into a tab that is filled with the html to which the link points:

/** Print the li elements that gets turned into tabs by jQuery **/
<ul>
<?php foreach ($projects as $project): ?>

    <li><a href="project_edit/<?php echo $project['id'] ?>"><?php echo $project['name'] ?></a></li>

<?php endforeach ?>
</ul>

In my case, each links sends a different project id as a parameter to a view called project_edit. Within project_edit there is a form:

<!-- Form contained within a typical tab -->
<form id="proj_form">
    <label for="title">Title:</label><input type="text" value="Comm. Ag. Ext." name="title" />
    <label for="project">Project:</label><input type="text" value="Agriculture" name="project"/>
    ...
    <br/><button type="button" name="proj_submit">Update Project</button><br/>
</form> 

When the form is submitted I use $this->input->post() to get the contents of the form’s input elements so I can supply them to my database:

/** I handle the form's submit and send the form contents to an 'update' method of the project_edit class **/
$(function(){
    $('button[name="proj_submit"]').click(function(){
        vol_params = $('#proj_form').serialize();
        $.post('project_edit/update', vol_params, function(data) {
            console.log(data);
        });
    });
});

/** Inside the project_edit model **/
$data = array(
    'title' => $this->input->post( 'title', true ),
    'project' => $this->input->post( 'project', true ),
    ...
    );

$this->db->update( 'projects', $data, array( 'id' => $this->input->post( 'proj_id', true ) ) );

This all works perfectly on the first tab. However, on every subsequent tab, when the form is submitted, the first tab’s contents are supplied to $this->input->post(). I assume this is because, when switching between tabs, the inactive tabs remain on the page and have their “display” property set to “none”. Therefore, only the first element with the name attribute matching the first parameter of $this->input->post() makes it into the post array (the first input with name=”title”, the first input with name=”project”, etc).

How can I overcome this limitation? I would prefer that only the active (currently displayed) tab be submitted.

  • 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-29T04:31:09+00:00Added an answer on May 29, 2026 at 4:31 am

    Change the forms’ ID to a class instead. And then handle the form submit using .submit() instead of capturing click events on buttons. Inside the callback function use $(this) to refer to the form that is being submitted and don’t forget to prevent the default action by calling preventDefault()

    $(function(){
        $('form.proj_form').submit(function(e){
            e.preventDefault();
            vol_params = $(this).serialize();
            $.post('project_edit/update', vol_params, function(data) {
                console.log(data);
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view called DashboardView that instantiates multiple WidgetView s. Each widget needs
We have a View (call it X) that is the base view called by
General context : MVVM application. I have a View called JobView. Its DataContext is
I have a Django view called change_priority. I'm posting a request to this view
I have a view and template called index.html. I have a image which is
I have a view who's methods are called by the accelerometer updates in the
I have a view with a class called drawingViewController, and I have the drawRect
I have a primary link accommodation, then i have created a view , called
I have a file called 34.php?session=2534464a39a2c97cb7113689726a4e52 in my /var/www/html folder but I can't view
I have a view called MyViewController, that I initialize from a xib file. Its

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.