Highlighted
Trusted Contributor.
Trusted Contributor.
265 views

HPSM 9.31 Format Control - Validate at least One of Two Checkboxes are Checked

Hi All,

Sorry for the odd request, I have two checkboxes, inc.prof and prob.prof, and I need to ensure at least one of them is checked, before the record can be saved or added.

Trying the following in Validation does not work (Add/Update: true):

inc.prof in $file~=NULL and prob.prof in $file~=NULL

Then I tried to create a couple of Calculations:

on add/update/display:null(inc.prof in $file)

Calculation: $chk1=true

2nd Calculation:

add/update/display: null(prob.prof in $file)

Calculation: $chk2=true

then in Validation

Init/Upd: true

Validation: $chk1~=true and $chk2~=true

 

When attempting to save regardless of one, both, or neither it throws my Message.

 

Any help would be greatly appreciated, thank you!

0 Likes
3 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: HPSM 9.31 Format Control - Validate at least One of Two Checkboxes are Check

Hi Jay,

you can try this

Add a Popup Message Box rule

Applies to User Roles:

System Administrator

Implementer

This rule enables you to create and configure popup message boxes that appear to end users.

To add a Popup Message Box rule, follow these steps:

  1. In the System Navigator, click Tailoring > Process Designer > Rule Sets.
  2. Click Search to open the Rule Set form, and then select the rule set to which you want to add the rule.

    Note: You can edit user-defined rule sets only. Out-of-box rule sets are labeled as HP Proprietary and cannot be modified.

  3. Click Add Rule to open the Select Rule Type page, and then click Popup Message Box.
  4. In the Rule Description field, type a description of your new rule.
  5. Click Edit to add conditions to the rule.

    Note: If you do not specify a condition, the value defaults to Always.

  6. In the Using this message section, select whether you want to set a fixed message or to configure the message text by using a JavaScript. Then, enter the message or JavaScript in the relevant text box.

    Note: If you select a fixed message, you can additionally enter localized versions of the message. If you select to set the message text by using a JavaScript, the JavaScript implementation handles the message localization.

    To localize a fixed message, first save the rule, and then open it for editing. An Edit localized labels button is now displayed next to the Fixed Message field. Click the button to configure the language code, message ID, and text of the localized message.

  7. Select the message box type. The following options are available:
    • Ok only

      This type of message box provides end users with the option to click "Ok" only. When you select this rule type, you must select the message level and set the behavior when the user clicks "Ok."

    • Yes, No

      This type of message box provides end users with the option to click "Yes" or "No." When you select this rule type, you must set the behavior when the user clicks "Yes" or "No."

    • Yes, No, Cancel

      This type of message box provides end users with the option to click "Yes," "No," or "Cancel." When you select this rule type, you must you must set the behavior when the user clicks "Yes," "No," or "Cancel."

  8. Click OK to add the new rule to the rule set.
Carlos Villalobos R
Customer Support Engineer
If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: HPSM 9.31 Format Control - Validate at least One of Two Checkboxes are Checked

Try this:

On Javascript tab, true on add/update:

if ( vars.$file.inc_prof == null && vars.$file.prob_prof == null )
    { vars.$profsBothNull = 'yep'; }
else
    { vars.$profsBothNull = 'nope'; }

On Validations tab, true on add/update:

$profsBothNull="nope"

So here you want the $profsBothNull variable to be "nope" in order for the record to save and your message to not display. 🙂

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: HPSM 9.31 Format Control - Validate at least One of Two Checkboxes are Checked

Hello.

Why do you need to use Calculation ?

I think you can use just Validations

For Add\Update (true in this line or your conditions)

In Validation:

inc.prof in $file="true" or prob.prof in $file="true"

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.