473,395 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Javascript Form Submission Variables

Hi Everyone! This is a great forum by the way..

Anyway, I have a PHP script, that gathers some basic information from a database and pre-populates a form for a user. The HTML that's generated looks something like this (to be brief):

Source (with PHP variables) for the Submit looks something like this:
Expand|Select|Wrap|Line Numbers
  1. <img src="/images/disk.gif" height="24" width="24" alt="Save" onclick="document.dnsform.edit['.$jsiter.'].checked=true; processsingle('.$jsiter.');">
  2.  
HTML Source After Execution:
Expand|Select|Wrap|Line Numbers
  1. <img src="/images/disk.gif" height="24" width="24" alt="Save" onclick="document.dnsform.edit[0].checked=true; processsingle(0);">
  2.  
Source Input:
Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="edit['.$jsiter.']" id="edit" value="'.$row->ident.'">
  2.  
HTML Results (view source):
Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="edit[0]" id="edit" value="258">
  2.  
I'm trying to grab that "258" value out of the "edit[0]" variable within Javascript.

This is what I've got so far and it doesn't work. :(

(to be brief, I'm just trying to alert the user of the variable to make a simple exmaple)

Expand|Select|Wrap|Line Numbers
  1. var params = encodeURI ( ( 'edit['+idx+']' ) );
  2. alert(params);
  3.  
I would have expected an alert box with "258" in it, but it's no good. Is this more complicated that what I'm making out to be?

Thanks,
CM
Jul 30 '07 #1
3 1151
gits
5,390 Expert Mod 4TB
hi ...

to retrieve the value of the following input-field:

[HTML]<input type="checkbox" name="edit[0]" id="edit" value="258">[/HTML]
simply use:

Expand|Select|Wrap|Line Numbers
  1. var field_value = document.getElementById('edit').value;
kind regards
Jul 31 '07 #2
hi ...

to retrieve the value of the following input-field:

[HTML]<input type="checkbox" name="edit[0]" id="edit" value="258">[/HTML]
simply use:

Expand|Select|Wrap|Line Numbers
  1. var field_value = document.getElementById('edit').value;
kind regards
Easy enough! Thanks, I appreciate it. Works well.

CM
Jul 31 '07 #3
gits
5,390 Expert Mod 4TB
glad to hear ;) ... come back to the forum when you have more questions ...

kind regards
Jul 31 '07 #4

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

Similar topics

5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
8
by: Prometheus Research | last post by:
http://newyork.craigslist.org/eng/34043771.html We need a JavaScript component which will auto-submit a form after a set period has elapsed. The component must display a counter that dynamically...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
10
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get...
12
by: googlegroups | last post by:
Hi, I'm making a javascript program for rolling dice for a roleplaying game that's played in a forum. The die roll gets generated, gets stored as text in a hidden form field, and then gets written...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
4
by: Goofy | last post by:
Hi everyone, My question is related to making a form submit using javascript. Here is my scenario. I have a form, which includes a user control. The user control has a search button and a...
2
by: Rahina | last post by:
I am working in Dreamweaver 8, and I have created a simple form: http://www.realmofmystery.com/app.html This is a free website I am doing for some friends, so nothing fancy. And, I learned web...
3
Plater
by: Plater | last post by:
I am having a spot of trouble with a little situation. I want to make the submit invisible on a submit so that the user cannot keep clicking on it while the server is receiving the file transfer....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.