marcos
Occasional Observer

RULES on COMBOBOX and VISIBLE property

Jump to solution

Hi everyone,

I am trying to build a weekday selector with CMS_COMBOBOX and depending on the day a CMS_INPUT_TOGGLE with radio type should appear to allow the editor to choose if it is a 'Open' or 'Closed' day. I am trying to define this with rules.

 

	<RULE>
		<WITH>
			<EQUAL>
				<PROPERTY name="ENTRY" source="st_weekdays"/>
				<TEXT>Sunday</TEXT>
			</EQUAL>
		</WITH>
		<DO>
			<PROPERTY name="VISIBLE" source="st_radio"/>
		</DO>
	</RULE>
		<WITH>
			<EQUAL>
				<PROPERTY name="ENTRY" source="st_weekdays"/>
				<TEXT>Monday</TEXT>
			</EQUAL>
		</WITH>
		<DO>
			<PROPERTY name="VISIBLE" source="st_radio"/>
		</DO>
	</RULE>
	<RULE>
		<WITH>
			<EQUAL>
				<PROPERTY name="ENTRY" source="st_weekdays"/>
				<TEXT>Saturday</TEXT>
			</EQUAL>
		</WITH>
		<DO>
			<PROPERTY name="VISIBLE" source="st_radio"/>
		</DO>
	</RULE>

 

My question is how can I properly define all weekday entries in one rule because splitting them like in the example above will result in only the last rule to be enforced. As in, the last value is the only one that will trigger the VISIBLE property on the INPUT_TOGGLE.

Rules seem to be a popular topic on this forum but as far I have searched I didn't find anything that suited my needs.

Thank you for your time.

Marcos

0 Kudos
1 Solution

Accepted Solutions
hoebbel
Crownpeak employee

Dear Marcos,

I would use the <MATCHES> tag. Something like this:


<RULE>
    <WITH>
        <MATCHES regex="^(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)$">
            <PROPERTY name="ENTRY" source="st_weekdays"/>
        </MATCHES>
    </WITH>
    <DO>
        <PROPERTY name="VISIBLE" source="st_radio"/>
    </DO>
</RULE>

Maybe the regex expression doesn't work. Just test a little (e.g. with just "(Sunday|Monday)", till you find a working one 😉 

Best regards
Holger

View solution in original post

2 Replies
hoebbel
Crownpeak employee

Dear Marcos,

I would use the <MATCHES> tag. Something like this:


<RULE>
    <WITH>
        <MATCHES regex="^(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)$">
            <PROPERTY name="ENTRY" source="st_weekdays"/>
        </MATCHES>
    </WITH>
    <DO>
        <PROPERTY name="VISIBLE" source="st_radio"/>
    </DO>
</RULE>

Maybe the regex expression doesn't work. Just test a little (e.g. with just "(Sunday|Monday)", till you find a working one 😉 

Best regards
Holger

marcos
Occasional Observer

Dear Holger

That does indeed solve my problem.

Thank you for your time.

 

Best regards

Marcos

0 Kudos