Multiple if conditions
Hi experts..
Im trying to make multiple if conditions in acrobat javascript, so my problem is easy i want to alert the user and then change the value of field if the user enter the wrong number.. so my approach was the following..but it give me errors (in custom validation scripts for the field)
| switch (event.value) { | ||
| case "0": | ||
this.getField("PeriodVar").value = 20; app.alert("zero not accepted"); | ||
| break; | ||
| case "": | ||
this.getField("PeriodVar").value = 20; app.alert("empty not accepted"); | ||
| break; | ||
| // case > 20: | ||
// this.getField("PeriodVar").value = 20; app.alert("over 20 not accepted"); | ||
| // break; | ||
| } |
| i tried to make multiple if condition with else but also i faild, i only success in the following code as a function : |
function checkmaxperval()
{
var maxsum = getField("PeriodVar");
var usingsum = maxsum.value;
if (usingsum > 20 ) {
app.alert("maximum value is 20 only", 3);
maxsum.value = 20;
return;
}