The objective of this problem is to pop a warning message if user hit submit button with no address and take no action, but the problem is submit button don't have click event.
I am checking a address field, if the address field has some value then it should proceed to submit the form, otherwise it should popup a message and don't take any action.
Form.#pageSet[0].Page1.FOOTER_EN_FRAGMENT.FSSUBMIT_PC::mouseUp - (JavaScript, client)
var addr1 = HEADER_EN_FRAGMENT.CUSTOMER_ML_ADDRESS_1.rawValue;
var addr2 = HEADER_EN_FRAGMENT.CUSTOMER_ML_ADDRESS_2.rawValue;
if(addr1 == null || addr1 == "" || addr2 == null || addr2 == "")
{
app.alert("Address field can't be blank!",3);
FSSUBMIT_PC.validate = "disable";//need help here
}
Right now its just displaying the error message, but still submitting when button is click. I want it to take no action but I don't know how to do that in adobe livecycle designer.
Also please tell me if there is any other way to pop up error message other than app alert.
Thanks in advance!
So basically what I learned each button has 3 control type regular, execute and submit. In submit and execute button type we can have click event so what we need to do, add a second button with control type regular and place it over the first button with control type submit and in second button click even call first button,
var addr1 = form1.Page1.HEADER.CUSTOMER_ML_ADDRESS_1.rawValue;
var addr2 = form1.Page1.HEADER.CUSTOMER_ML_ADDRESS_2.rawValue;
if(addr1 == null || addr1 == "" || addr2 == null || addr2 == "")
{
xfa.host.messageBox("Address field cannot be blank.");
}
else
{
FSSUBMIT_PC.execEvent("click");
}