Forum Moderators: open
Is it possible to refresh a field in AJAX way after a certain event took place..In my case after a onKeyUp event.Here's the situation..there is a simple mathematical equation with 3 field which are "Val1","Val2" and Val3". On "Val1" field, whenever I input a number, the computed value will be updated on the spot on "Val3"."Val2" is a constant value.
The things that I did is to put a javascript _doClick('$Refresh', this, '_self'); .. so whenever I key in a value in "Val1", the page will be refresh..but it will be great if it can be done using AJAX since I want only the particular field to be refresh.
My program is develop in Domino and feel free to share any idea and thought.
Do you have to send information back to the server to calculate this value or can it be accomplish with javascript? If the latter is true, you will not need an AJAX solution.
Once we clarify this we can script the solution accordingly. :)
It is something like this..
2[Va1] * 20[Val2] = 40[Val3]
In domino,I can set the field properties and in this case.. I set the Val3 proporties by adding the calculation formula.
[edited by: encyclo at 1:40 am (utc) on Jan. 9, 2007]
[edit reason] no URLs please, see TOS [webmasterworld.com] [/edit]
<html>
<head>
<script type="text/javascript">
function formula() {
var form = document.forms[0];
var num1 = form.val1.value;
var num2 = form.val2.value;
var num3 = (num1*num2); //your formula simplifies to this
form.answer.value = num3;
return;
}
</script>
</head>
<body>
<form>
<input type="text" name="val1" /> * <input type="text" name="val2" /> = <input type="text" name="answer" disabled /><br/>
<input type="button" onClick="javascript:formula()" value="Calculate" />
</form>
</body>
</html>
I hope this answers your question :)
P.S. I simplified your formula however the answer will still be the same.