Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Manage data states by filling an array pre-display of form data and comparing

    I want to manage data states by filling an array pre-display of a dynamicform data and then comparing the data in the form fields after the user has left a form field.

    for example, you load a form of customer information and the user changes the phone number, after the user leaves the phone number text box I want to compare the data in the text box with the originally loaded data to determine whether to enable the save changes button. If however later in the same session the user changes the phone number back, I want to again compare against the original data and then disable the save changes button as nothing has actually changed.

    I normally would do this by loading all the form data into an array and on exiting a text box or picklist, etc. determine whether the form data is the same or not.

    Is there some suggestions on how best to do this with smartclient?

    #2
    To detect the user undoing and a change and reverting to the original value, you will need to track both the original values and changes to those values in separate Arrays.

    We'd recommend implementing form.itemChange() to receive notifications of user changes, and storing changed values from this method.

    Each time the user visits or re-visits a record, call form.setValues() with that record's values, then form.setValue(fieldName, value) with each of the unsaved changes you are tracking. This will allow you to use form.valuesHaveChanged() to enable or disable your "Save Changes" button, for both first time edits and re-edits of the same record.

    Comment

    Working...
    X