Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
dfgowans007 #1
FORM LIVE UPDATE
I am creating a page which has a number of forms,
this page deals with accounts.
The expensise are enetered in the relivatant forms and then they are saved in a mySQL db via PHP.
THE PROBLEM
The data is being saved fine and sum is added up HOWEVER
the added data needs to also to be shown live on the page when entered and updated live as more values are entered in the fields.
How do I do this I am at a total loss, the only way I can think is taking the data individualy and each time refreshing the page which is a fairly rough option to use.
Thanks,
David .F. Gowans
[email]Gowans007@yahoo.com[/email]
dfgowans007 Guest
-
Embed live cue data in live stream?
I am currently using the new FME to encode live to a FMS. Both applicatioins are running on the same machine. Is there a way to embed live cue and... -
Live data feed within live flash video?
Is there a way to encode some live data, say from a serial port into a live video stream? Windows media has such a feature within the script window. -
Fill form field in existing PDF from database live
Hi, I'm wondering if this is possible. To have a pre-generated PDF on a server with an existing form field for a personalized message. Then,... -
Update Records form
Dreamweaver MX 2004 ASP with VBasic I have a form page which passes a parameter to an update page. The parameter is passed for the first record... -
update form
A value in an autonumber field is assigned by your database when the record is added to the table. It's not updateable, so you can't make use of... -
rob :: digitalburn #2
Re: FORM LIVE UPDATE
Just use some JavaScript... it's easy.
rob :: digitalburn Guest
-
dfgowans007 #3
Re: FORM LIVE UPDATE
any tips on how to do that or where to get the info to do it
dfgowans007 Guest
-
rob :: digitalburn #4
Re: FORM LIVE UPDATE
Well, it's pretty easy, but no doubt they'll be some particular problems
thrown up by exactly what you're doing.
You need a function that detects whenever content is added to (or changed
in) one of your input fields. The easiest way to do this, I should think, is
to have the function called every time the focus is shifted away from one of
these fields.
All the function needs to do is take the value of the field being altered,
and add it to the value already existing in your output field - simple :)
So, assuming you have a form called 'stuff', with fields called input+a
number and output, your function might look something like this-
function changeOutput(n){
//where n is the number of the input
//there's no error checking, the function assumes you know what you're
doing
//findObj is a Macromedia function, if you don't have DW, you can use
document.getElementById, but it's less robust in some cases
frm=findObj('stuff');
currentOutput=parseInt(frm.output.value);
eval('inputValue=parseInt(frm.input'+n+'.value)');
frm.output.value=currentOutput+inputValue;
}
That's very off-the-top-of-my-head, but it should work... there may be
better ways of doing it...
dfgowans007 wrote:> any tips on how to do that or where to get the info to do it
rob :: digitalburn Guest
-
dfgowans007 #5
Re: FORM LIVE UPDATE
Ok ive had a go & sorta go something that sorta works HURRAY
!!!!BUT!!!!!
This needs to be inside a form which saves the data to a mysql db.
but when it this script is inside another form it does'nt work ARG!!
how can I get this to work,
I dont need the totals to save as the db can work that out
but each entered variable my be saved to the db.
PAGE CODE ATTACHED
<html>
<head>
<script language="javascript">
<!--
function addIt(){
var value1 = document.adder.in_sloan.value
var value2 = document.adder.in_parent_cont.value
var value3 = document.adder.in_pt_job.value
var value4 = document.adder.in_other.value
document.adder.output.value = parseFloat(value1) + parseFloat(value2) + parseFloat(value3) + parseFloat(value4)
var value5 = document.adder.in_sloan2.value
var value6 = document.adder.in_parent_cont2.value
var value7 = document.adder.in_pt_job2.value
var value8 = document.adder.in_other2.value
document.adder.output2.value = parseFloat(value5) + parseFloat(value6) + parseFloat(value7) + parseFloat(value8)
document.adder.finalout.value = parseFloat(value1) + parseFloat(value2) + parseFloat(value3) + parseFloat(value4) + parseFloat(value5) + parseFloat(value6) + parseFloat(value7) + parseFloat(value8)
}
//-->
</script>
</head>
<body>
<FORM NAME="adder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td><table width="52%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="in_sloan" type="text" onChange="addIt()" value=0 size=4>
var1 </td>
</tr>
<tr>
<td><input name="in_parent_cont" type="text" onChange="addIt()" value=0 size=4>
var2 </td>
</tr>
<tr>
<td><input name="in_pt_job" type="text" onChange="addIt()" value=0 size=4>
var3</td>
</tr>
<tr>
<td><input name="in_other" type="text" onChange="addIt()" value=0 size=4>
var4 </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input type="text" name="output" size="6">
<strong> tot </strong></td>
</tr>
</table></td>
<td> </td>
<td><table width="44%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="in_sloan2" type="text" onChange="addIt()" value=0 size=4>
var5</td>
</tr>
<tr>
<td><input name="in_parent_cont2" type="text" onChange="addIt()" value=0 size=4>
var6</td>
</tr>
<tr>
<td><input name="in_pt_job2" type="text" onChange="addIt()" value=0 size=4>
var7</td>
</tr>
<tr>
<td><input name="in_other2" type="text" onChange="addIt()" value=0 size=4>
var8</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input type="text" name="output2" size="6">
<strong>tot2</strong></td>
</tr>
</table></td>
<td><input name="finalout" type="text" id="finalout" size="6">
<strong>final tot </strong></td>
</tr>
</table>
</FORM>
</body>
</html>
dfgowans007 Guest
-
rob :: digitalburn #6
Re: FORM LIVE UPDATE
So... what you're saying is that when you try to call this function from a
different form, it doesn't work? Is that it? Or...?
Saving the output variables is kind of a non-issue as far as the whole thing
working or not is concerned, they get passed to your PHP like all the rest,
so you can either use them or not, it doesn't really matter.
rob :: digitalburn Guest
-
dfgowans007 #7
Re: FORM LIVE UPDATE
no the scrpit works but when i put it inside the form needed to save the details to mySQL via php it stops working I think cos it has a form within a form, any ideas?
dfgowans007 Guest
-
rob :: digitalburn #8
Re: FORM LIVE UPDATE
So you're nesting the whole of this form inside another form? Is that
correct? If so, I don't think that nesting forms is ever a great idea. There
should be another way to set up your page.
rob :: digitalburn Guest



Reply With Quote

