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 6124981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:11:44+00:00 2026-05-23T16:11:44+00:00

I have many forms on my site. When the Submit is triggered on the

  • 0

I have many forms on my site. When the Submit is triggered on the form I expect to receive an id of the form and the option selected.

html

<form name="order">
  <select id="count">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
  </select><br/>
  <input type="text" name="id" value="6" />
  <input href="#" type="submit" value="Submit" /> 
</form>

JavaScript

    var fancyboxOptions = {
    ajax : {
        type: "POST",
        data: {
            id: null,
            count: null
        }
    }
}

$(document).ready(function() {

    fancyboxOptions.ajax.data.id = $('input[name="id"]').val();
    fancyboxOptions.ajax.data.count = $('#count').val();

    $('div#buy input').fancybox(fancyboxOptions);

    $('#count').change(function() {
        fancyboxOptions.ajax.data.count = $('#count').val();
    });

With this code I receive only data from the first form — when the submit is triggered other forms I receive data from the first form rather than from the form I pressed submit on.

How do I restructure my code, so the form submits triggers the submit to give me only the the data in the form for which I pressed submit.

PS Do not pay attention a fancybox, it’s work good.

  • 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-23T16:11:44+00:00Added an answer on May 23, 2026 at 4:11 pm

    May want to change your code to something like this

    <script>  
    $('input[name=id]').parent().change(function(){
       fancyboxOptions.ajax.data.id = $(this).find('input[name="id"]').val();
       fancyboxOptions.ajax.data.count = $(this).find('#count').val();
    });
    </script>
    

    This will install a change handler on each form which contain a input field named id, and the callback function (which is installed on the parent() form ) will have access to “this” which the can navigate the DOM and find all the sub-fields relative to the form node.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a single page with many forms of existing records: index.html.haml -
I have a form MainForm which is a Windows Forms form that contains many
I have seen this same question in many forms on this site and in
I have many forms that use AJAX (w/ jQuery) for validation and data submission.
Contributing to open source can have many forms: working with issue trackers, patches, further
I have a page with many forms in panels and usercontrols, and a requiredfield
I have a page with many forms on it. could be 1..200. None of
I have a Tcl/Tk app that generates many forms and would like to be
I have quite a large VB6 project, with many forms, classes, modules and user
i have many textboxes on a form and all textboxes require to have a

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.