how do i do this ?

wxdqz

New Member
For an intranet application :
I have 3 form fields
e.g. A,B,C

C should represent a sum of A & B. However all three fields are entered by the user.

now I want to validate if C matches the sum of A & B, as C was entered by the user also. If it doesn't match a message box should pop-up where the user needs to enter a ticket number (which they need to create) and I want to store this value in a hidden field and then submit the form.

This is what i currently have :

function checkForm() {
var a = document.form3.A.value;
var b = document.form3.B.value;
var result = eval(a-0) + eval(b-0);

if (eval(document.form3.C.value) != result);
{
var ticket = prompt("Totals do NOT match !\n\n Create ticket and enter the number here:","")
return false;
}

It should not be possible to submit the form without a ticket number.
I am stuck all the way, I don't really understand how Javascript functions in this matter.
Please help me out.

Thanx,

BaKMaN
 
Back
Top