3.5.3.8.1. Examples for Customizables Buttons
The next two examples will show some of the possibilities for the customizable buttons. On example 1 we have a OnButtonUpdate, on example 2 there is a OnButtonClick script.
EXAMPLE 1:
Change button styling, title and tooltip depending on the value of the user field Order Number.
OnButtonUpdate:
If UserField_Order_number.value = "" Then
UserButton_1.SetWebStyle "btn-danger"
UserButton_1.SetTitle "SET ORDER"
UserButton_1.SetEnabled 1
Else
UserButton_1.SetEnabled 0
UserButton_1.SetWebStyle "btn-success"
UserButton_1.SetTitle "ORDER SET"
End If
TEST = ChronoDocument.get_doctype_param("TEST","0")
If TEST = "0" Then
UserButton_2.SetTitle "READ TAXES"
UserButton_2.SetTooltip "The field tax is used for validation"
UserButton_2.SetWebStyle "btn-success"
Else
UserButton_2.SetTitle "IGNORE TAXES"
UserButton_2.SetTooltip "The field tax is not used for validation"
UserButton_2.SetWebStyle "btn-warning"
End If
EXAMPLE 2:
The button will perform a check on the document type parameter READTAXES
OnButtonClick:
TEST = ChronoDocument.get_doctype_param("READTAXES","0")
If TEST = "0" Then
UserButton_1.SetTitle "DONE(1)"
UserButton_1.SetWebStyle "btn-warning"
Call ChronoDocument.set_doctype_param("READTAXES ","1")
Else
UserButton_1.SetTitle "DONE(0)"
UserButton_1.SetWebStyle "btn-success"
Call ChronoDocument.set_doctype_param("READTAXES ","0")
End If