Is there any way to make the value specified for "Display Group Based on the Value of a Field?" dynamic? (make it retrievable from the factbase)
If not directly, then perhaps some workaround using JavaScript. If you can point me in the right direction I would appreciate it.
The container I am wanting to hide, based on a value of a field, is inside a repeat control.
If not directly, then perhaps some workaround using JavaScript. If you can point me in the right direction I would appreciate it.
The container I am wanting to hide, based on a value of a field, is inside a repeat control.
Attachment
RE: display group based on field, making dynamic
Unfortunately this is not something that is directly supported by WebMaker.
In order to achieve this you will probably need to stop using the 'Display Group Based on the Value of a Field?' option completely, and instead replicate this functionality using JavaScript.
I would first create a hidden field next to the group to contain the dynamic value that should be used to control the group visibility. You can configure the page display bindings for this in the normal way to pick up your dynamic value.
Then add an onchange event to your control field that contains the following type of custom script:
var showValue = document.getElementById(objEventSource.repeatId + 'show_value').value; var currentValue = document.getElementById(objEventSource.repeatId + 'control_field').value; if (showValue == currentValue) { hyf.util.showComponent(document.getElementById(objEventSource.repeatId + 'layout_group')); } else { hyf.util.hideComponent(document.getElementById(objEventSource.repeatId + 'layout_group')); }
This assumes that the control field, group, and new hidden field are all in the same repeat, and are called 'control_field', 'layout_group', and 'show_value' respectively.
Also, if you control field is not a text box then you would need to adjust this accordingly.
Another area you will need to consider is making sure that the visibility is correct on page load. It might be best to loop through all the control fields on load and just call the onchange function on each one.
I hope this makes sense, and helps you get started on this.
Regards,
Gerard
RE: display group based on field, making dynamic