Validating ADM2 Fields

Posted by Admin on 06-Sep-2009 15:26

Two issues:

1) I have a SmartViewer with some check boxes.  One box is an 'Ignore' checkbox.  If that is checked, I would like to disable the other checkboxes.  Can someone suggest the best way to code this?

2) I'm having trouble working with ADM2 triggers.  When I create an 'ON VALUE-CHANGED' procedure,  it no longer considers that field changed and the 'Save Record' icon in the SmartToolbar doesn't enable as it normally would if I had checked / unchecked the box without an 'ON VALUE-CHANGED' trigger, so I can't save the change.  Is there a way to manually override this behavior?

TIA

Paul

All Replies

Posted by Admin on 06-Sep-2009 15:35

I don't understand the full usecase for #1. But usually overriding the procedures enableFields and disableFields in the Viewer is a good starting point. Don't forget to RUN SUPER. from the override and disable the fields after RUN SUPER.

The second is a common issue. The ADM2 depends on a generic ON VALUE-CHANGED trigger. By definind a custom one, you disable the original trigger (the ABL can only have a single event handler per event/control).

To restore the original behaviour, try running

RUN valueChanged IN TARGET-PROCEDURE.

at the end of your VALUE-CHANGED trigger. Whenever you modify a field from custom code, remember to set the fields MODIFIED attribute to TRUE to make sure that the field get's saved.

Posted by Admin on 06-Sep-2009 21:46

Mike,

#2 is resolved -- Thanks!

For #1, I've looked through 3 manuals and can't find any sample code, so I'm unsure of the syntax.  It looks like I create two procedures in the Viewer called enableFields and disableFields and in each add the 'RUN SUPER.' line, but I'm not sure what should follow.  The field to validate is called, 'K-Ignore' and if checked, I want to display 'K-City' and K-County'.  If not checked, I want to do the opposite.  Could you write some sample code of how it should look?

I'm also thinking of changing the background color of K-Ignore whether it's checked or not.  I can do this in ON VALUE-CHANGED, but don't know how to display the correct background color as I browse through each record.  Any help with this would also be appreciated.

Paul

Posted by Admin on 06-Sep-2009 23:56

Sounds like you're viewers fields are enabled by default (Toolbars Update Mode set to Save, not Update).

Try overriding the dataAvailable procedure in the viewer. That get's fired whenever there's a new or changed row. Don't forget the character input parameter.

This thread is closed