Question

Hiding buttons or fields under certain conditions

Hi,

 

My use case is to add a button in the page that executes a process. This is pretty straight forward in freedom UI and i was able to achieve it.

 

However, the button always renders even during the creation of a record and update.

What i ended up doing is to create a new attribute "isButtonVisible" and creating 2 handlers; one for 

crt.HandleViewModelInitRequest and crt.HandleViewModelAttributeChangeRequest

For the HandleViewModelInitRequest i check if the PrimaryModelMode is equal to "create" then i set that attribute to false. Subsequently, in the HandleViewModelAttributeChangeRequest handler if a field has changed value then i also set that attribute to false assuming that the PrimaryModelMode is update. Using the new attribute i set that to be used for the button visibility. 

 

What i am asking is if there is a better way to go about achieving this goal? The behavior i am looking for is the same as the "Close" button in the form page. Is there some property that I'm missing that can be used instead to determin if the record is being updated or created. I just want the button to render only when there is no modification/creation being performed.

 

Any advise would be greatly appreciated. 

 

Thanks,

J

Like 0

Like

2 comments

If you look at the Cases_FormPage it hide a lot of elements of the page is in “create” mode using a business rule that just checks if CreatedOn is filled in or not. 

Ryan

Hi Ryan,

 

I couldn't find the CreatedOn field/property via business rule or the JS. There is a field called created time though. Also, do you have any suggestions for the update?

 

Thanks,

J

Show all comments