Customization of Expiration date field in Redwood
Summary:
want to hide the continue button, want to make it a hard block. Tried to add a fire notification on National identifier if it starts from 9 but its not working as it comes for a short duration and goes away, need to make expiration date mandatory if the National identifier starts from 9 or hide the continue button
Content (please ensure you mask any confidential information):
define([], (ActionChain, Actions, ActionUtils) => {
/**
*
- @param {object} context
- @return {boolean}
*/
function runCondition(context) {
const { $fields, $messages, $value } = context;
const expirationDate = $fields.personNationalIdentifiers?.ExpirationDate?.$value();const nationalId = $fields.personNationalIdentifiers?.NationalIdentifierNumber?.$value();const isValidNationalId = typeof nationalId === 'string' && /^9\d{8}$/.test(nationalId);const isExpirationDateEmpty = expirationDate === null || expirationDate === undefined || expirationDate === '';if (isValidNationalId) { if (isExpirationDateEmpty) { $messages?.addError?.( 'Error Message: Expiration Date is allowed only when National ID starts with 9.' ); return false; } return true;}if (!isExpirationDateEmpty) { $messages?.addError?.( 'Error Message: Expiration Date is allowed only when National ID starts with 9.' ); return
Tagged:
0