Show/Hide a Button Widget based on "State" field on Form Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2017 01:54 AM
Hi SNC,
I have a customized Service Portal Page where I had a button to take me to another page.
Now, bellow this button widget I have the Form Widget that shows me specific fields from a selected table. One of those fields is "state" and I would like to show/hide de Button Widget based on this "state" field present on Form Widget.
Any ideas on how to access the Form Widget "state" field value on the Button Widget?
Thanks in advance.
Fábio Gonçalves
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2017 02:56 AM
Hi Fabio,
The batter option is to create a UI Action on related table. If you still need to create UI Action on portal side then you could follow below approach...
Server Code :
data.hideButton = true;
if(data.table == 'tableName' && data.f._fields.state.display_value == "Choice Display Value"){
data.hideButton = false;
}
HTML Template:
<button ng-hide="data.hideButton">
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2017 07:26 AM
Hi Gurpreet,
Thanks for your answer.
But I am afraid I didn't quite understood the part "data.f._fields.state.display_value == "Choice Display Value"". My Server code contains the following:
"
data.hideButton = true;
if(data.table == 'dmn_demand' && data.f._fields.state.display_value == "Screening"){
data.hideButton = false;
}
"
But that doesn't seem to work. The button is always missing once I add this condition, even when the state = Screening.
Any ideas on what I might be doing wrong?
Thanks,
Fábio Gonçalves
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2022 02:16 AM
hello gurpreet,
can you please explain this in details how to use.