celso-jP
Support threads created in the last 30 days: 0
Favorite Forum Topics
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Populate a second SELECT FIELD with info from a first chosen SELECT FIELD.bus
Started by: celso-jP in: Toolset Professional Support |
2 | 5 | 7 years ago |
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Form Advanced Conditional Display Based on Age and Birthdate Field
Started by: celso-jP
in: Toolset Professional Support
Problem: I have a Form that includes a custom date field. That date field is used to save a birthdate. I would like to create a conditional group that displays some content in the Form if the birthdate is less than 18 years ago. Solution: Toolset's date fields store Unix timestamps that represent dates. These are simple numbers. If you want to compare that date to a date in the past, you need to create a Unix timestamp for that date in the past. Then you can compare those two timestamp values like comparing any other numbers. The following custom shortcode can be used to generate a Unix timestamp from the text string "18 years ago": add_shortcode( 'tssupp-strtotime', 'tssupp_strtotime'); function tssupp_strtotime($atts = []) { $atts = shortcode_atts([ 'string' => '', ], $atts); $time = strtotime($atts['string']); return $time; } Register tssupp-strtotime in Toolset > Settings > Front-end Content > Functions Inside Conditional Evaluations. Then in the basic Form builder you can implement the shortcode in a conditional like so: ( '$(cliente-data-de-nascimento)' gt '[tssupp-strtotime string="18 years ago"]' ) Or in expert mode: [cred_show_group if="( '$(cliente-data-de-nascimento)' gt '[tssupp-strtotime string="18 years ago"]' )" mode="fade-slide"] Age is less than 18 [/cred_show_group] Relevant Documentation: |
2 | 3 | 5 years, 1 month ago | ||
Populate a second SELECT FIELD with info from a first chosen SELECT FIELD.bus
Started by: celso-jP in: Toolset Professional Support |
2 | 5 | 7 years ago |