Hi all. I am Trying to get a few popup messages to work on a form but have not been successful at all. I did this once before and I did work but on this form I have had no luck. No popup messages work at all and I get no error message. Please see if you can help with my script. if(root.P1.matched.Consent.rawValue == 1) { if(root.P1.client.variable_option_client.cv6.rawValue == null && root.P1.client.variable_option_client.cv7.rawValue == null && root.P1.client.variable_option_client.cv25.rawValue == null) xfa.host.messageBox("Please enter at least one contact number and select a product from the Product Section.", "Notice", 1); root.P1.matched.Consent.rawValue = 0 ; } else if ((root.P1.client.variable_option_client.cv6.rawValue != null || root.P1.client.variable_option_client.cv7.rawValue != null) && root.P1.client.variable_option_client.cv25.rawValue == null && root.P1.client.variable_option_client.cv26.rawValue == null && root.P1.client.variable_option_client.cv27.rawValue == null && root.P1.client.variable_option_client.cv28.rawValue == null) { xfa.host.messageBox("Please select a product from the Product Section.", "Notice", 1); root.P1.matched.Consent.rawValue = 0; } else if ((root.P1.client.variable_option_client.cv6.rawValue == null && root.P1.client.variable_option_client.cv7.rawValue == null) && root.P1.client.variable_option_client.cv25.rawValue != null) { xfa.host.messageBox("Please enter at least one contact number.", "Notice", 1); root.P1.matched.Consent.rawValue = 0 ; } else if ((root.P1.client.variable_option_client.cv6.rawValue != null || root.P1.client.variable_option_client.cv7.rawValue != null) && root.P1.client.variable_option_client.cv25.rawValue != null) { root.P1.matched.EmailSubmitButton1.presence = "visible"; root.P1.matched.EmailSubmitButton2.presence = "visible"; // this is event that triggers the script to lock all fields. //myScriptObject.LockAllFields(root.P1.client.variable_option_client); //myScriptObject.LockAllFields(root.P1.client.variable_option_client.cv6); if (root.P1.client.variable_option_client.DateTimeField1.$.rawValue > "15:00") { xfa.host.messageBox("The time is after 3pm. Please inform the customer that they are likely to be contacted on the next working day."); } } } else { root.P1.matched.EmailSubmitButton1.presence = "invisible"; root.P1.matched.EmailSubmitButton2.presence = "invisible"; } Thanks Joey
Views
Replies
Total Likes
Hi Joey,
The xfa.host.messageBox method has four parameters. The first one (message) is required, whereas the last three are optional. However when you include any of the last three parameters, you need to include all of the three optional parameters.
You are missing one of the last two parameters, either the icon or button types.
When debugging there are two quick checks:
Hope that helps,
Niall
Hi Niall,
Can I then remove the ("Notice", 1) from the end of the message box function?
I have run the syntax checker and sorted out one } that was not needed.
If I preview the form and (CTRL-J) nothing happens at all.
Also only thr first popup message appears, the rest dont follow through when making the correct
selections.
Thanks
Joey
Views
Replies
Total Likes
I am away now, so can't check your script.
The if statements are complex, so I suspect that there is something amiss there. Check your relative references and the logic (mixture of !=null and ==null).
You can drop parameters two, three and four.
When you say nothing happens, does the JavaScript Console open?
Niall
Views
Replies
Total Likes
Hi,
I think you are missing a bracket in the code. I have put the bracket where I think it is missing ( made it bold and a little bigger too). Having a look at the logic but it looks alright at first glance.
if(root.P1.matched.Consent.rawValue == 1)
{
if(root.P1.client.variable_option_client.cv6.rawValue == null && root.P1.client.variable_option_client.cv7.rawValue == null && root.P1.client.variable_option_client.cv25.rawValue == null)
{
xfa.host.messageBox("Please enter at least one contact number and select a product from the Product Section.", "Notice", 1);
root.P1.matched.Consent.rawValue = 0 ;
}
else if ((root.P1.client.variable_option_client.cv6.rawValue != null || root.P1.client.variable_option_client.cv7.rawValue != null) && root.P1.client.variable_option_client.cv25.rawValue == null && root.P1.client.variable_option_client.cv26.rawValue == null && root.P1.client.variable_option_client.cv27.rawValue == null && root.P1.client.variable_option_client.cv28.rawValue == null)
{
xfa.host.messageBox("Please select a product from the Product Section.", "Notice", 1);
root.P1.matched.Consent.rawValue = 0;
}
else if ((root.P1.client.variable_option_client.cv6.rawValue == null && root.P1.client.variable_option_client.cv7.rawValue == null) && root.P1.client.variable_option_client.cv25.rawValue != null)
{
xfa.host.messageBox("Please enter at least one contact number.", "Notice", 1);
root.P1.matched.Consent.rawValue = 0 ;
}
else if ((root.P1.client.variable_option_client.cv6.rawValue != null || root.P1.client.variable_option_client.cv7.rawValue != null) && root.P1.client.variable_option_client.cv25.rawValue != null)
{
root.P1.matched.EmailSubmitButton1.presence = "visible";
root.P1.matched.EmailSubmitButton2.presence = "visible"; // this is event that triggers the script to lock all fields.
//myScrip tObject.LockAllFields(root.P1.client.variable_option_client); //myScrip tObject.LockAllFields(root.P1.client.variable_option_client.cv6); if (root.P1.client.variable_option_client.DateTimeField1.$.rawValue > "15:00")
{
xfa.host.messageBox("The time is after 3pm. Please inform the customer that they are likely to be contacted on the next working day.");
}
}
}
else
{
root.P1.m atched.EmailSubmitButton1.presence = "invisible"; root.P1.m atched.EmailSubmitButton2.presence = "invisible";
}
Regards
Malcolm
Hi Malcom, That has definitely helped. I have put in the extra bracket and the code runs. Now I need to get the submit buttons to appear if the right selections are made. This is not happening at present even if the right fields have the correct data. Joey
Views
Replies
Total Likes
Hello Everyone,
In Java Script there are two types of message box for displaying information. One is known as “alert” and another one is known as “confirm”. If you want to display an alert or warning regarding programs then we use alert () method for displaying message box and if we want to take some confirmation from user then we use confirm () method for displaying message box........
Please check out the this link for more details....
Thanks !!!!!
Views
Replies
Total Likes
I don't believe that works in LiveCycle.
This group is for LiveCycle Designer, it's not the same as programming for browsers.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies