Making Events Conditional
Sometimes we want events to trigger conditionally. Given our editable listbox, a good example
of this is that we want the submitting of the new Item to only happen if the user has
typed in something in the textbox.
Basically, if the textbox is blank, no event should trigger. (You can verify this now by
clicking "Add Item" without while keeping the textbox completely blank.)
QCubed supports this by allowing all events to have optional conditions. These conditions
are written as custom javascript code into the Event constructor itself.
In this example, we explicitly name the textbox's ControlId as "txtItem" so that we can
write custom javascript as conditionals to the button's Click and the textbox's
EnterKey.