473,791 Members | 3,090 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ajax POST checkbox

7 New Member
guys,

I can't seem to find any info on how to pass a list of checked checkboxes through POST method of ajax.

Unlike traditional forms, when you submit a button, a list of selected checkboxes with the same name will allow you to retrieve it at the server side (php in my case).

IS this the only way?

Expand|Select|Wrap|Line Numbers
  1.  param = "selecteditem = " + document.myform.item[0].value;
  2. param+ = "&selecteditem = " + document.myform.item[1].value;
  3. param+ = "&selecteditem = " + document.myform.item[2].value;
Can there be any other ways so that i won't have to manually append each value to the same variable before posting the data?
Nov 24 '07 #1
1 2261
gits
5,390 Recognized Expert Moderator Expert
hi ...

since you don't post the page you have to build the querystring for your own ... because you have to identify the values for your own that have to be send to the server ...

but you may write a generic function that you may call in case of building the querystring ... the function should retrieve all input-fields of the page or a specific node ... and always builds a querystring from it ...

kind regards
Nov 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2992
by: noballack | last post by:
I've got a problem, I'm working with Ajax in a web with a form with a list of checkbox added to the form via an Ajax.Updater method. These added checkboxs are not been sended by the form if I use Firefox or Safari. My source code is something like that: <script type="text/javascript" src="http://www.my_web_page.com//js/prototype-1.4.0.js"></script> <script> function showMoreOptions( url, pars, div_id ){ if...
4
4985
by: d3vkit | last post by:
I have a form on my page, and some javascript which uses ajax to submit the form, and then opens the new page in a div using ajax so there is no refresh. This works fine. But the problem is this: all values seem to pass except what the submit buttons say. I have a preview button and a finish button, and need to check which was pressed. I can add a checkbox for submit, but that's annoying. I'm using mootools for the ajax call, so it might not...
7
1320
by: Bill Gower | last post by:
I have a asp.net form where if the user checks a check box I need to disable some of the fields. I don't need to make a trip to the server for anything at this point so is this is a case of using javascript to disable the fields or should I be using Ajax do that? As probably can be seen from my post I have never used Ajax yet. Bill
3
1821
by: John Mott | last post by:
This is a total ID-10T error, but since its my first attempt I'm missing the obvious. I downloaded the framework, create an AJAX enabled app, added a page, and added an update panel with this: <asp:UpdatePanel ID="updateCategory" runat="server"> <ContentTemplate> <asp:CheckBox runat="server" ID="chkCategory" OnCheckedChanged="chkCategory_OnCheck" />
3
2608
sunbin
by: sunbin | last post by:
Hi, I am having in a Trouble when working with dynamic checkboxes (i.e. checkboxes with the same name, e.g. <input type="checkbox" name = "check" value="dynamic integer value">) I have submitted an HTML form (which contains dynamic textboxes and dynamic checkboxes with a Post Button(input type="button")) by using Ajax function. (onClick="return ajaxFunction(document.getElementById('formid'));") In the ajax function, i have collected...
3
3557
by: arggg | last post by:
I have a form in PHP that needs to be processed by the same page. I have ajax calling the page and parsing the data however I cannot get the POST data to be sent via AJAX to the PHP Page. I found this site which gives me an idea that you need to setup the $_POST methods as what looks like a GET then you send the information to the PHP page which in turn interprets it as $_POST data. However I was wondering is there a way that without me...
1
2057
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped working. Any ideas? <%@ Page Language="VB" AutoEventWireup="false" CodeFile="default-ajax.aspx.vb" Inherits="pages_verify_groups_Default" Debug="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
0
1301
by: Tim | last post by:
Hi all, I'm using AJAX.NET and I've coded a page that changes the text of a button when a checkbox is clicked. The text changes from "Save" to "Keep Processing". The text change seems to work. However, when I then go to click on the button, I click once, and nothing happens. I click again, and get an error:
1
4612
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in Database but I'm stuck in the EDIT. I'm getting 2 problems over here. Below is the description: 1)The FIRST page will list all the records from the table which Admin can EDIT with CHECKBOX for each record to select. He can select one or more than one...
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10155
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.