This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes jQuery submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery submit " Watch "jQuery submit " New topic
Author

jQuery submit

Joe Stela
Greenhorn

Joined: Mar 22, 2012
Posts: 15
Hello,

I want to get the employee nos from selected checkbox,but I am getting it as null .

Below is my code.

I am selecting multiple employees from check box and then clicking on one button. The button has clickFunction() as below which is just submitting the form.
I am trying to submit the Form using jquery submit and employeeForm is the id of form field

function clickFunction(){
$('#employeeForm').submit();
}

After submit I am going to one jsp and trying to get the checkbox selected values in that jsp using request.getParameterValues("employeeList");
employeeList is name of my checkbox.

But I am getting null. Please let me know if I am missing something.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Is the checkbox checked?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Stela
Greenhorn

Joined: Mar 22, 2012
Posts: 15
yes , checkbox is checked.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Use the browser's debugger to look at the request. It will show you whether the request parameter is encoded into the body (for a POST) or the URL (for a GET).
Joe Stela
Greenhorn

Joined: Mar 22, 2012
Posts: 15
I am using firebug...but its not showing me anything related to this request, though its showing me data related to other requests.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

The debugger in Chrome and Safari has a Network tab that show all activity. I primarily use Chrome/Safari for developing these days as I think the debugger is better.
Ashwini Kashyap
Ranch Hand

Joined: Aug 30, 2012
Posts: 90
Hi Joe,
Also make sure you are checking the checkbox in your function like:

$("#fieldID").attr("checked", "checked");

Thanks,
Ashwini Kashyap
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Show you html markup.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Ashwini Kashyap wrote:
Also make sure you are checking the checkbox in your function like:
$("#fieldID").attr("checked", "checked");

That does not do any checking -- it sets the element's checked attribute.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jQuery submit
 
Similar Threads
Struts validation problem..
Pass some checkbox values from one JSP to another
List to string
Submit button
Help! Form to update multiple records upon save