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!

  • 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.
  • 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. :)

  • 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"