JavaScript alert and if
I have to fields called 'Lmin' and 'Lmax' with values.
Another Field 'Given L' is to be filled out, but must be equal to min og max - or in between.
An alert is suppose to pop of if the enteres value does not meet the specification, and the value will be set to 0.
I have made the validation for 'Given L' in javascript, but has a few things that keeps bugging me:
- After activating the alert, the cursor is in the next field. I would like to return to the 'Given L'
At the end of the document I have a 'claer all fields'-button.
It works ok, but the min-alert pops up when I activate it - and then clears the fields like it's supposed to.
JaveScript in validation of 'Given L':
var min = this.getField("Lmin").value;
var max = this.getField("Lmax").value;
var nValue = Number(this.getField("Given L").value);
if(nValue=0);
else if(event.value<min){
app.alert("WRONG min");
event.value = 0
};
if(event.value>max){
app.alert("WRONG max");
event.value = 0
};
event.value
