Anatomy of the Zero Width Mod

From nuBuilderForte
Jump to: navigation, search

Functionality available in NuBuilder 4.5

When a lookup field and description are the same, the latter's width should be set to zero - gets hidden.

This article illustrates how such mods are done.

Back porting to NuBuilder 4

This has since been integrated into the updated v4.

  • Navigate to
    Home => Forms => Code: nuobject => Custom Code
  • Append the following function into the Javascript pane
function nuSetLookupWidth() {
    var w = $('#sob_lookup_description').val() == $('#sob_lookup_code').val() ? 0 : 150;
    var cw = $('#sob_lookup_description_width').val();  
    if (cw == 0 || cw == 150 || w == 0) $('#sob_lookup_description_width').val(w).change();
}
  • This action can be done with a DB update statement as well.
  • The above function when invoked makes sure that only if the Code and Description are the same field the width is set to zero.
  • Now we invoke the function when the field name is cycled through (onchange) the Code and Description input text fields by running the following SQL statements on the database:
INSERT INTO zzzzsys_event (zzzzsys_event_id, sev_zzzzsys_object_id, sev_event, sev_javascript) VALUES 
('nu5ff0b31354688aa', 'nu5bad6cb32e1a66a', 'onchange', 'nuSetLookupWidth()');

INSERT INTO zzzzsys_event (zzzzsys_event_id, sev_zzzzsys_object_id, sev_event, sev_javascript) VALUES 
('nu5ff0b329e242e25', 'nu5bad6cb32e47d18', 'onchange', 'nuSetLookupWidth()');
  • We verify these actions (or do it here instead of the in the DB) by navigating to:
Objects => sob_lookup_code        => Custom Code => Event: onchange | Javascript: nuSetLookupWidth()
Objects => sob_lookup_description => Custom Code => Event: onchange | Javascript: nuSetLookupWidth()