Announcement

Collapse
No announcement yet.

Cancel changes in Form Application

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cancel changes in Form Application

    I designed my form application to be disabled when loading for update and enabled for new record. I want to avoid user accidentally make changes and save it.

    Here is on my onLoad event on the form application:

    Code:
    if(sc_btn_new) {
        sc_btn_display('update', 'on'); 
        sc_field_disabled("code=false;name=false;status=false;description=false");
    } else {
        sc_btn_display('update', 'off'); 
        sc_field_disabled("code;name;status;description");
    }
    Actually, I prefer to set readonly, but somehow it did not work using sc_field_readonly ( Can someone help on this?) But, at the moment, sc_field_disabled would do.

    Next, I add AJAX type button which has this code,

    Code:
    sc_btn_display('update', 'on');                          // This is to show the save button
    sc_btn_display('upd_record', 'off');                   // This is to hide my "Edit" button
    sc_field_disabled("code=false;name=false;status=false;description=false");
    
    // I need one more line to display the "Cancel" button like in "Add New"
    sc_btn_display('cancel', 'on');         // This line is not working and not showing the cancel button
    I need one more button to cancel the changes so that changes to my form fields are not save (back to initial values) and the onLoad event is run again. Something like if in Insertion (Add New), there is a "Cancel" button.

    Should I make another self-made ajax button? But what should the code to refresh the page?

    Cheers,

    Daniel
Working...
X