Here's a custom validation script you can use for FIeld 1. Just tailor the error messages to suit you needs:
// Custom Validate script for Field 1
(function () {
// Do nothing if value is blank
if (!event.value) {
return;
}
// Convert entry to a number
var nVal = +event.value;
// Deal with negative/zero values
if (nVal <= 0) {
app.alert("Please enter a positive value.", 3);
// Reject entry
event.rc = false;
return;
}
// Deal with a value greater than 1,000,000
if (nVal > 1000000) {
app.alert("Please enter a value equal to or less than 1,000,000.", 3);
event.rc = false;
return;
}
// Deal with a value that's not a multiple of 10,000
if (nVal % 10000) {
app.alert("Please enter a value that is a multiple of 10,000.", 3);
event.rc = false;
return;
}
// Everything is OK, so nothing more to do
})();
For Field 2, the script could be modified to something like:
// Custom Validate script for Field 2
(function () {
// Do nothing if value is blank
if (!event.value) {
return;
}
// Convert entry to a number
var nVal = +event.value;
// Get the value of Field 1, as a string
var s1 = getField("Field 1").valueAsString;
// Reject entry if field 1 is blank
if (!s1) {
app.alert("Please first enter a value in Field 1", 3);
event.rc = false;
return;
}
// Convert Field 1 value to a number
var n1 = +s1;
// Deal with a value greater than Field 1 value
if (nVal > n1) {
app.alert("Please enter a value less than or equal to Field 1", 3);
event.rc = false;
return;
}
// Deal with negative/zero values
if (nVal <= 0) {
app.alert("Please enter a positive value.", 3);
event.rc = false;
return;
}
// Deal with a value greater than 500,000
if (nVal > 500000) {
app.alert("Please enter a value equal to or less than 500,000.", 3);
event.rc = false;
return;
}
// Deal with a value that's not a multiple of 10,000
if (nVal % 10000) {
app.alert("Please enter a value that is a multiple of 10,000.", 3);
event.rc = false;
return;
}
// Everything is OK, so nothing more to do
})();