Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set your conditions here
- // FIELD_KEY:OPTION_VALUE:FIELD_KEY_TO_SHOW
- $conditions = [
- 'destination:pelion:ekdromi Pelion',
- 'destination:crete:ekdromi crete',
- 'destination:rhodos:ekdromi rodos',
- ];
- // DO NOT EDIT BELOW
- JHtml::script('com_convertforms/conditional_fields.js', ['relative' => true]);
- $options = JFactory::getDocument()->getScriptOptions('com_convertforms');
- foreach ($conditions as $key => $form_1_condition)
- {
- $parts = explode(':', $form_1_condition);
- $options['conditional_fields'][1][] = [
- 'if' => [
- [
- 'field_name' => $parts[0],
- 'value' => $parts[1]
- ]
- ],
- 'then' => [
- [
- 'field_name' => $parts[2],
- 'trigger' => 'show_field'
- ],
- [
- 'field_name' => $parts[2],
- 'trigger' => 'is_required'
- ]
- ],
- 'else' => [
- [
- 'field_name' => $parts[2],
- 'trigger' => 'hide_field'
- ],
- [
- 'field_name' => $parts[2],
- 'trigger' => 'is_not_required'
- ]
- ]
- ];
- }
- JFactory::getDocument()->addScriptOptions('com_convertforms', $options);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement