user1753622
user1753622

Reputation: 288

XPages validateExpression failing

I have a field with a validationExpression (shown below) which should error if the field is empty and a previous radio button has been selected. However, even if I have the radio button "BOM" selected the save continues, but it shouldn't. Any ideas anyone?

if (getComponent("radioGroup3").getValue() == "BOM") {
    if (getComponent("OrderDateRequired").getSubmittedValue() == "") {
        return false;
    } else {
        return true;
    }
} else {
    return true;
}

Upvotes: 1

Views: 178

Answers (1)

Panu Haaramo
Panu Haaramo

Reputation: 2932

You need to use validateRequired validator for checking if the field is empty. Other validators are not run if there is no value. You can use value in your code to check for the field value.

Upvotes: 1

Related Questions