473,411 Members | 2,085 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,411 software developers and data experts.

Reference field in mult-record form

I want to use the javascript dom to reference the field of a record in a
multi-record html form when that field has been changed. How do I reference
the field? I have a JavaScript function coded as:

var zownerID = document.updOwners.ownerID.value
var zownerName = document.updOwners.ownerName.value
document.updOwners.mysql_update.value = zownerID
document.updOwners.newName.value = zownerName

I have tried calling it from onclick for the submit button and onsubmit for
the form with no success. Very new to javascript and would appreciate any
help. Thanks
Jul 23 '05 #1
5 1854
Rose wrote:
I want to use the javascript dom to reference the field of a record in a multi-record html form when that field has been changed. How do I reference the field? I have a JavaScript function coded as:

var zownerID = document.updOwners.ownerID.value
var zownerName = document.updOwners.ownerName.value
document.updOwners.mysql_update.value = zownerID
document.updOwners.newName.value = zownerName

I have tried calling it from onclick for the submit button and onsubmit for the form with no success. Very new to javascript and would appreciate any help. Thanks


Hi Rose.

'javascript dom' is a misnomer: the former is a scripting language, the
latter a language-independent object model.

Not entirely clear what you're trying to do. Post your HTML along with
a description of what you need to happen.

Jul 23 '05 #2
Lee
Rose said:

I want to use the javascript dom to reference the field of a record in a
multi-record html form when that field has been changed. How do I reference
the field? I have a JavaScript function coded as:

var zownerID = document.updOwners.ownerID.value
var zownerName = document.updOwners.ownerName.value
document.updOwners.mysql_update.value = zownerID
document.updOwners.newName.value = zownerName

I have tried calling it from onclick for the submit button and onsubmit for
the form with no success. Very new to javascript and would appreciate any
help. Thanks


Don't use the onclick of the submit button. Some browsers don't
support such a thing, and there are often other ways to submit a
form than clicking the button.

<form ... onsubmit="doStuff(this)">

function doStuff(formRef) {
formRef.mysql_update.value = formRef.ownerID.value;
formRef.newName.value = formRef.ownerName.value;
}

Jul 23 '05 #3
I am displaying names selected from a mysql database table. I want to be
able to change a name and have that change update the mysql database table.
This is the html, javascript, and php code. Thanks...

<html>
<head>
<link href="../../../../../../styles/canDC.css" rel="stylesheet"
media="screen">
<script type="text/javascript" name="fpownerID" language="JScript5.0">
<!--
function fpownerID()
{
var zownerID = document.updOwners.ownerID.value;
var zownerName = document.updOwners.ownerName.value;
document.updOwners.mysql_update.value = zownerID;
document.updOwners.newName.value = zownerName;
alert("Function Executed");
}
// -->
</script>
<csactions>
<csaction name="1AE4950" class="Call Function" type="onevent"
val0="fpownerID" val1=""></csaction>
</csactions>
<csscriptdict import>
<script type="text/javascript"
src="../../../../../../GeneratedItems/CSScriptLib.js"></script>
</csscriptdict>
<csactiondict>
<script type="text/javascript"><!--
CSAct[/*CMP*/ '1AE4950'] = new Array(CSCallFunction,'fpownerID','');

// --></script>
</csactiondict>
</head>
<body bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0"
topmargin="0">
<form action="ProcessForm.php" method="post" name="updOwners"
onsubmit="CSAction(new Array(/*CMP*/'1AE4950'));" cssubm="1AE4950">
<table height='200px' width='385' border='1px' cellspacing='1px'
cellpadding='0' align='center'>
<tr><td class="can"><div style='align:center; height:100%; width:100%;
overflow:auto'>
<table class="can" height='100%' width='100%' border='1px'
cellspacing='2px' cellpadding='0' align='center'>
<?php
$zqueryRecords=" SELECT o.ownerID, o.ownerName FROM fp_owners o WHERE
o.ownerID> 0 ORDER BY o.ownerName";
$resultRecords=mysql_query($zqueryRecords);
echo mysql_error();
while($zRecords = mysql_fetch_array($resultRecords))
{
?>
<tr align='center'>
<td class='formField'>
<input type='hidden' name='ownerID' value='<?php echo
$zRecords[ownerID];?>'>
<input class="left" type='text' name='ownerName' size='40' maxlength='50'
value='<?php echo $zRecords[ownerName];?>'>
<input class="button" type="submit" name="updButton"
value="Update"></td></tr>
<?php }?>
</table>
</div>
</td>
</tr>
</table>
<div align="center">
<input type="hidden" name="newName" value="">
<input type="hidden" name="required" value="mysql_update_value, newName">
<input type="hidden" name="redirect" value="brmv_owners.php">
<input type="hidden" name="redirect_type" value="include">
<input type="hidden" name="mysql_table" value="fp_owners">
<input type="hidden" name="write_to_mysql" value="newName > ownerName">
<input type="hidden" name="mysql_update_field" value="ownerID">
<input type="hidden" name="mysql_update_value" value=""></div>
</form>
</body>
</html>
Jul 23 '05 #4
Thanks... will keep this in mind.
Jul 23 '05 #5
Believe it or not, I actually got it to work. I hate being so new to a
programming language that I don't even know how to properly refer to it.
Thanks for your response.

"RobB" <fe******@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Rose wrote:
I want to use the javascript dom to reference the field of a record

in a
multi-record html form when that field has been changed. How do I

reference
the field? I have a JavaScript function coded as:

var zownerID = document.updOwners.ownerID.value
var zownerName = document.updOwners.ownerName.value
document.updOwners.mysql_update.value = zownerID
document.updOwners.newName.value = zownerName

I have tried calling it from onclick for the submit button and

onsubmit for
the form with no success. Very new to javascript and would appreciate

any
help. Thanks


Hi Rose.

'javascript dom' is a misnomer: the former is a scripting language, the
latter a language-independent object model.

Not entirely clear what you're trying to do. Post your HTML along with
a description of what you need to happen.

Jul 23 '05 #6

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

Similar topics

2
by: ImraneA | last post by:
Hi there Got a interesting problem (depends on a point of view.....). Background :- Agent (within Domino) is run daily basis which extracts data from Domino Notes application to SQL Server...
2
by: dotnetguy | last post by:
Hello, having a FieldInfo object I'd like to get a reference to the corresponding field object. I know the type of the field object (so I can do a cast if it is required) but I don't know if...
6
by: WayneD | last post by:
Hi All, Just got started in C#... Here's some C# code: public MyClass { private MyThingy m_Thingy;
6
by: Chris Simmons | last post by:
I know that a String is immutable, but I don't understand why this piece of code fails in nUnit: // BEGIN CODE using System; class Test { public static void Main( String args )
0
by: dba123 | last post by:
THERE HAS TO BE A SOLUTION FOR THIS!!!! How can I get around the limitation in SSRS 2005 of being able to SUM a Group referenced field in my FOOTER!!! It's driving me nuts My footer field's...
1
by: Lighter | last post by:
On page 163 of In the C++ standard document(9.6 Bit-fields), I find three rules on bit-fields: Rule 1, "A bit-field shall not be a static member." Rule 2, "A non-const reference shall not be...
20
by: Protoman | last post by:
OK, this code compiles, links, and executes, but, how do I setup, like, a spinlock to query the DataBase object's status to let the SmrtPtr know that the object's been deleted?: #pragma once ...
44
by: gokkog | last post by:
Hi there, There's a classic hash function to hash strings, where MULT is defined as "31": //from programming pearls unsigned int hash(char *ptr) { unsigned int h = 0; unsigned char *p =...
3
by: GaryDean | last post by:
I have serveral applications now running that are using the MembershipProvider classes and they are each using their own security tables in SQL Server 2005 instead of the express databases - they...
4
by: kasthurirangan.balaji | last post by:
Hi, Recently i came across a functiion declaration as below void f(char *&a); Nowhere i have come across this style. I understand, passing by reference is always better(to avoid copying),...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
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
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...
0
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,...
0
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...
0
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...

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.