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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:39:45+00:00 2026-06-08T22:39:45+00:00

I have a JSP page with a form. When I submit the form, it

  • 0

I have a JSP page with a form. When I submit the form, it build and gerenates a JSON string that I do an AJAX post with.

I have a problem though, I need to get multiple values out of the form,and I am using the following to do this:

 .find('input[name=item1])
 .not('input[type=hidden]')  

How can I do this to get inputs with names item1, item2 and item3?

I tried this but it didn’t work?

 .find('input[name=item1][name=item2][name=item3]')

Below is my code for this:

    // Create JSON based data object
    $.fn.serializeObject = function()
    {
        var o = {};
        var a = this.serializeArray();
        $.each(a, function() {
            if (o[this.name] !== undefined) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });

        return o;
    };

    // Form Submission
    $('#form').submit( function() {

        // Create data array, used for building request message
        var data = {
            request: { 
                requestType: "request",
                fields: [ { 
                    itemX1 : '1',
                    itemX2 : '2',
                    itemX3 : '3'
                } ] 
            }
        };  

        // Create field array based variables for request message
        var fields = {
            fields: [ { 
                itemX1 : null,
                itemX2 : null,
                itemX3 : null
            } ] 
        };              

        // Get reqired data from the form submitted
        fields = $('#form')
        //.find('input')
        .find('input[name=lmBtId][name=my]')  
        .not('input[type=hidden]')    
        .serializeObject();

        // Set the field array variables with data
        fields.itemX1 = '1';
        fields.itemX2 = '2';
        fields.itemX3 = '3';

        // Update data array with newly updated field array
        data.request.fields = [fields];
        var finalData = JSON.stringify(data);
  • 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-06-08T22:39:47+00:00Added an answer on June 8, 2026 at 10:39 pm

    This page will provide information on selectors,

    http://api.jquery.com/multiple-selector/

    Please try this

    .find('input[name=item1],[name=item2],[name=item3]')
    

    And do something for each of them add,

    .each(function(){
    //code here
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one form in JSP. I have some input fields in that page,
Hello i have a JSP page that contain a form, i want to validate
I have the below table in a .JSP page: <form:form method=post action=update.dtt id=contactForms modelAttribute=contactForms
I have a JSP page that needs to accept some info into a form,
I have some jsp page manage.jsp and form inside it: <form method=POST action=./manage.form> <div
I have a login.jsp page: <form method=post action=url:8081/login.xhtml> Username : <input type=text name=txtUsername/> Password
I'm using Spring Web Flow (v. 1.0.5) and I have a JSP page that
I have a functional JSP page that accepts URL parameters and updates a table
I have a JSP page that renders, and calls a Web service to load
I have a jsp form which takes in user details. On submit button it

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.