Advertisement

08.27.2008 at 06:57AM PDT, ID: 23682005 | Points: 500
[x]
Attachment Details

Prototype integrated into form generated from mysql database

Asked by bloggermouth in JavaScript, PHP and Databases, JavaScript Frameworks

In the following form there is an element that posts to search for a particular driver. I am not sure if my approach is correct. The driverID is what I am looking at. Each row of the form is given a unique ID.

What I am looking for is a method that will be easy to understand that will allow prototype to query the database for a driver and put the correct name in the correct row (hence the unique ID).

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
//prototype
 
function checkDRVID(row) {
	if($F('driverID').length >= 2) {
		var url = 'inc/finddriver.php';
		var params = 'driverID=' + $F('driverID');
		alert(params);
		var ajax = new Ajax.Updater({success: 'IDMResult'+row},url,{method: 'post', parameters: params, onFailure: reportMError});
	}
}
 
function reportMError(request) {
	$F('IDMResult') = "Error";
}
 
//html
 
<table>
<tr valign="top" bgcolor="#f8f8ff">
	<td><b>Ballantrae Stone &amp; Stoves Limited</b></td>
	<td width="29"><input name="driverID[ZYC]" id="driverID[ZYC]" style="height: 12px; width: 25px;" onkeyup="checkDRVID('ZYC');" type="text"></td>
	<td width="200"><div id="IDMResultZYC"></div></td>
	<td>
	<select id="load" name="load">		 
		<option value="3">Albert Road</option>
		<option value="1" selected="selected">Apple Grove</option>
	</select>
	</td>
	<td>
	<select id="unload" name="unload">		 
		<option value="7" selected="selected">Power plant</option>
		<option value="2">Tall Pines</option>
	</select>
	</td>
	<td>
	<select id="material" name="material">		 
		<option value="20" selected="selected">1" Septic Stone</option>
	</select>
	</td>
</tr>
<tr valign="top" bgcolor="#dcdcdc">
	<td><b>Ballantrae Stone &amp; Stoves Limited</b></td>
	<td width="29"><input name="driverID[PQQ]" id="driverID[PQQ]" style="height: 12px; width: 25px;" onkeyup="checkDRVID('PQQ');" type="text"></td>
	<td width="200"><div id="IDMResultPQQ"></div></td>
	<td>
	<select id="load" name="load">		 
		<option value="3">Albert Road</option>
		<option value="1" selected="selected">Apple Grove</option>
	</select>
	</td>
	<td>
	<select id="unload" name="unload">		 
		<option value="7" selected="selected">Power plant</option>
		<option value="2">Tall Pines</option>
	</select>
	</td>
	<td>
	<select id="material" name="material">		 
		<option value="20" selected="selected">1" Septic Stone</option>
	</select>
	</td>
</tr>
</table>
[+][-]08.27.2008 at 09:51AM PDT, ID: 22326866

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.27.2008 at 11:03AM PDT, ID: 22327541

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 08:05AM PDT, ID: 22335744

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628