473,938 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting values of multidimensiona l HTML select

BB
Hello,

I have a HTML form containing multidimensiona l selects listing
equipments and their quantitites. This allow the users to select the
kind of equipment and quantitites they would like to book. Upon
onChange select event I would like to parse the data into a
multidimensiona l Javascript array in order to check equipment
availability for booking. But I can't figure out how to parse and upon
JS HTML DOM reference I am not even sure it's possible.

For example one select lists available cameras:

<tr>
<td>
<label>Digita l camera</label>
</td>
<td>
<select name="camera[]" size="1" >
<option value="0" >0</option>
<option value="1" >1</option>
</select>
</td>
</tr>
<tr>
<td>
<label>Video camera</label>
</td>
<td>
<select name="camera[]" size="1" >
<option value="0" >0</option>
<option value="1" >1</option>
</select>
</td>
</tr>

For info, in my real situation, this select is dynamically populated
using PHP querying a database. All the booking processing is done with
PHP after the form has been posted. I now need to do some pre-flight
test and guess JS is the right guy to do so.

So, is there anyone with helpful ideas for parsing this
multidimensiona l HTML select into a multidimensiona l JS array?

Thank you,

Jan 17 '07 #1
2 3663
Lee
BB said:
>So, is there anyone with helpful ideas for parsing this
multidimension al HTML select into a multidimensiona l JS array?
There is no such thing as a multidimensiona l HTML select.

http://www.jibbering.com/faq/#FAQ4_25
--

Jan 17 '07 #2
ASM
BB a écrit :
Hello,

I have a HTML form containing multidimensiona l selects listing
equipments and their quantitites. This allow the users to select the
kind of equipment and quantitites they would like to book. Upon
onChange select event I would like to parse the data into a
multidimensiona l Javascript array in order to check equipment
availability for booking. But I can't figure out how to parse and upon
JS HTML DOM reference I am not even sure it's possible.
<script type="text/javascript">
function booker() {
var book = document.forms['form1'].elements['camera[]'];
var max = book.length;
var datas = '';
for(var i=0; i<max; i++) {
datas += book[i].options[book[i].selectedIndex].value;
if(i<(max-1)) { datas += ','; }
}
return datas;
}
</script>
For example one select lists available cameras:
<form name="form1">
<input type=button value="to see"
onclick="alert( 'choice = '+booker());" >
<table>
<tr>
<td>
<label>Digita l camera</label>
</td>
<td>
<select name="camera[]" size="1" >
<option value="0" >0</option>
<option value="1" >1</option>
</select>
</td>
</tr>
<tr>
<td>
<label>Video camera</label>
</td>
<td>
<select name="camera[]" size="1" >
<option value="0" >0</option>
<option value="1" >1</option>
</select>
</td>
</tr>
</table>
</form>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6779
by: Golf Nut | last post by:
I am finding that altering and affecting values in elements in multidimensional arrays is a huge pain in the ass. I cannot seem to find a consistent way to assign values to arrays. Foreach would clearly be the most efficient way to do it, but it only works on a copy of the original array and not the original (which is counter intuitive in my estimation). Using each doesn't work consistently either. Not only that, it's unduly complex for...
3
2174
by: Kenneth | last post by:
Hello all, I'm trying to do some form validation on a form that collects its data into a multidimensional array, and on submitting that re-writes the values as hidden form elements (a form that keeps adding submitted values to a multidimensional array). However, since the hidden form fields have to be identically named to the visible form fields, I can't make my JavaScript return an error if the field is blank because there are...
5
1962
by: TheKeith | last post by:
I can't figure out why this doesn't work: --------------------------------------------- greeting = new Array(); greeting = "hey"; greeting = "bye"; trace(greeting + greeting);
3
1353
by: BobbyS | last post by:
I am trying to develop a multidimensional array for use of searching a very large database. I understand the concept of one and two dimensional arrays but this project would include up to 12 or 13 criteiras for the search. The engine needs to be user friendly for general public use so the SQL/query path method is not really an option for me. I have heard or read about multidimensional cube arrays and am not sure if this is a viable method...
1
9810
by: Chuy08 | last post by:
If I have a multidimensional array like the following: Array $records =Array 0 = 30 year, 6.0; 1 = 30 year, 6.0; 2 = Pay Option, 1.0; 3 = Pay Option, 1.0; How could I flatten this to achieve an array that only has unique Product
2
2143
by: pm1ccc | last post by:
Hi, I have written following code and not getting back values in the same form ( i have used phpself) <?php $Fname = $_POST; $Lname = $_POST; $gender = $_POST; $food = $_POST; $quote = $_POST;
1
4946
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button. The Category name is being fetched from the oracle db along with the corresponding Category order. In the corresponding input field (text box) the user enters a new category order which gets stored in...
6
2421
by: cathyisfrustrated | last post by:
Hey, I've been trying to learn javascript for a few days. I'm a bit stuck! I'd appreciate any links to get me going in the right direction or any advice I can get. I've written a multidimensional array like this: var from_array = new Array(); from_array = new Array ( "Alice Springs", "1.5", "2.8"); new Array ( "Amberley", "1.5", "2.8") ;
9
2640
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of the main floors of the main house: Part C: Gross Floor Area of the basement or cellar: Part D: Gross Floor Area of the attic:
0
9963
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
11103
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
11284
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
10653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9854
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...
1
8214
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4901
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
2
4444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3496
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.