I am a new Caspio user. I have tried to work on Search and Report Wizard - Configure Details Page Fields.
I need to do some edit and calculations on several fields on the details page. I guess i must use javascript to achieve that. I have 3 fields lab_fee, c_discount, and credit_charge of Number Data type in my table.
My requirement are as follows:
1. The user must be able to edit lab_fee
2. When lab_fee is edited it should effect TotalFee automatically.
3. I put the javascript in the Footer like below. Right now when I tested (preview) it, it did not do anything at all. I have been searching for similar problems on the community forums for weeks now and nearly give up. i found some similar issues and i have tried to follow those but so for not fortunate enough. I look at the Caspio Online help Center topics "Why JavaScript is not working with multiple DataPages deployed on one page?" and I suspected that I might be in this situation. I currently deploy 3 Datapages on my website, and the one i am talking about is one of those three. The other 2 Datapages are working ok. Can anyone be kind enough to help me solve this issue. . The JavaScript syntax such as document.getElementById(“caspioform”) and document.forms[X]. drive me nut for a long while.
4. I have other calculations to perform as well, but for simplicity I only brought up this one.
5. I try to avoid coding by focusing on using Wizards as many as i can. Search and Report Wizard is the one i used for this case. But it seemed that what i try to achieve has to be done by javascript only.
Thank you very much guys.
<SCRIPT LANGUAGE="JavaScript">
function calculate1()
{
var v1 = document.getElementById("EditRecordlab_fee").value;
var v2 = document.getElementById("EditRecordc_discount").value;
var v3 = document.getElementById("EditRecordcredit_charge").value;
var v4 = v2 + v3 - v1;
document.getElementById("EditRecordTotalFee").value = Round(v4,2);
}
document.getElementById("caspioform").onsubmit =calculate1;
</SCRIPT>