is the LABKEY.ext.formPanel example right?

LabKey Support Forum (Inactive)
is the LABKEY.ext.formPanel example right? kevink  2010-07-09 13:22
Status: Closed
 
1. Yes, LABKEY.ext.FormPanel will help you by building the form items using the select rows metadata.

2. It doesn't do anything special to subit the form. I haven't used Ext's FormPanel much, but you may be able to use Ext.form.action.Submit.

3. It looks like LABKEY.Form does the dirty checking for you, but LABKEY.ext.FormPanel does not. I don't know if this is be design or just an oversight.

I haven't tried this, but it looks like you should be able to create a LABKEY.Form over the form of the LABKEY.ext.FormPanel. Something like:

var lkform = new LABKEY.Form({ formElement: myFormPanel.getForm() });

If that doesn't work, you can install a window.onbeforeunload handler to check form.isDirty() before nvaigating away. You can do this yourself or use the LABKEY.beforeunload helper function. The LABKEY.beforeunload helper takes a callback where you can add your own dirty check:

window.onbeforeunload = LABKEY.beforeunload(function () {
    return myForm.isDirty();
});

The form's isDirty() method is true when any of the fields have been changed from their original values.