Conditional logic interpretation for different elements

Different element has different interpretation for conditional logic, especially with the value and length. In this article, we are going to discuss it in full.

Element Property Comparison Against Remarks
  • MCQ > Single OptionMCQ > Multiple Options
  • Others > Radio Options
  • Others > Checkbox Options
  • MCQ > Dropdown Options
  • Others > Dropdown Options
Value The text of the label (or the dropdown item) of the option that is selected.
  • The text is always without any nested HTML or shortcodes (like LaTeX).
  • The text is always trimmed and lowercased.
  • When putting some HTML or shortcode, always put some simple text inside to make a comparison.
Length The number of checkboxes selected. In case of radio and dropdown, this is always one since only one can be selected.
  • MCQ > Single Slider
Value The numeric value of the slider. Since there can not be any length of a number, so it is pointless to use length. If you still need to check if it’s a n digit number, then use less than and/or greater than operators.
Length
  • MCQ > Single Range
Value Any of the numeric value of the range (minimum or maximum). The condition is satisfied, if any of the range value validates true.
Length
  • Spinners
Value  Any of the numeric value of the spinner options. There can be several options inside a spinner element. If any of the spinner value validates, then the condition holds true. If you need to validate against a particular option, then have only one option inside a spinner element.
Length Number of spinner options without empty value. The value 0 is not considered empty and will be considered in the total number of spinner options.
  •  Grading
Value Any of the numeric value of the grading options, or, any of the range (minimum or maximum). There can be several options inside a grading element. In case of slider type grading, the condition is set to true if atleast one of the value of the options validates it. In case of range type grading, the condition is set to true, if atleast one of the value of the ranges of the options validates it.
Length Number of grading options without empty value. Since grading options are always numeric and populated, this would always be equal to the number of options of the element.
  • Star Rating
  • Scale Rating

 

Value Any numeric value of the rating options. There can be several options inside a rating element. The condition is set to true if atleast one of the value of the options validates it.
Length Number of options with some rating. This is equivalent to the number of rated options, i.e, when the user has rated any option.
  • Smiley Rating
Value Numerical Value corresponding to the selected smiley. Please see remarks. The value/length is always mapped to the following numerical value for comparison:

smileyVals = {
	frown: 1,
	sad: 2,
	neutral: 3,
	happy: 4,
	excited: 5
};

So if you want to show an element is user selects a value which is equal or more than neutral, then add the following logic:

(has) value (which) great than (this value) 2
Length
  • Matrix
Value Column text for selected radios, checkboxes. There can be several rows in a matrix. The condition is set to true, if it validates with one of the columns where atleast once checkbox, radio is selected.
Length Total number of checkboxes, radios selected. This adds up to all the checkboxes or radios that the user has selected.
  • Matrix Dropdown
Value Option text for selected dropdowns.. There can be several rows in a matrix. The condition is set to true, if it validates with one of the columns where atleast one dropdown is selected with mentioned value.
Length Total number of dropdowns selected. This adds up to all the dropdowns that the user has selected. Dropdown options with default text aren’t considered.
  • MCQ > Toggle Option
  • Others > Single Checkbox

 

Value If the checkbox/toggle checked/enabled, then 1, otherwise 0. The value has nothing to do with the label of the element. It would always be one, if selected, zero otherwise.
Length
  • Feedback Small Text
  • Feedback Large Text
  • First Name
  • Last Name
  • Phone
  • Email
  • Address
  • Small Text
  • Large Text
  • Password
  • Address
  • Keypad

 

Value The text entered by the user inside the input. Always lowercased and trimmed.
Length The length of the text entered by the user inside the input. Then length is always calculated for lowercased and trimmed input.
  • File Upload
Value Total number of files uploaded.
Length
  • Mathematical Evaluator
Value Calculated value of the formula.
Length
  • DateTime
Value Considered as ISO datetime string. Always keep the format as YYYY-MM-DD H:m:i
Length

Swashata has written 249 articles

Hi there, I am the Lead Developer at WPQuark.com. I love to create something beautiful for WordPress and here I write about how to use them. When I am not working, usually I am doing a number of other creative things ;).