canUpdateList

IN THIS PAGE

Description

Fires when the user tries to update the List with edits that have been made to the List Detail View. If function returns false, action is cancelled. The data object is passed in as a member of the e.object. If you set properties in e.data, you can override the values that the user entered.

Parameters

This event passes a 'data' parameter when the Javascript code executes.

Example

You can use this event to override user entries. This detail view was built using the guide on the 'Dirty control class name' page.

  1. Create a List Control with a working detail view as described in Creating a Detail View with a Dirty Control Class.

    Can Ul
  2. In the Detail View pane click the [...] button next to the 'Events' property under the 'Client-side Events' section.

    Can Ul2
  3. Click the canUpdateList event, then view the work area where this event is defined.

    Can Ul3
  4. Add the following javascript:

    if( e.data.ContactName.toLowerCase().trim() === 'badname' ) {
        alert('Cannot have name of badname');
        return false;
    }
    Can Ul4
  5. Run the component in Live Preview. When you try to enter 'badname' into one of the Detail View fields and click 'Save', the component should return a 'Cannot have name of badname' message.

    Can Ul5
  6. If you click OK, then the change will then revert back to the pre-existing name.

    Can Ul6

See Also