Disabled Items = no update

Nov 26, 2009 at 2:36 AM
Edited Nov 26, 2009 at 2:39 AM

Guys,

I am using the ability to disable items in my EditForm.aspx code. The challenge I am having is that fields which are disabled (but mandatory) cause the update process to kick back to the EditForm with the fields blank. Do I have re-enable them on submit? Here is the lockdown code:

    var lockall = function() {
        var edittime = ["Title", "BusinessUnit", "SubGroup", "BUApprover", "Period", "RequestStatus"];
        if (readonly) { // if form is locked then disable all entry fields
            for (var x in jP.Form.Items) {
                try {
                    $(jP.Form[jP.Form.Items[x].InternalName].Item).find("input", "select", "textarea").attr("disabled", "disabled");
                }
                catch (ex) {
                    //alert(ex.message + " " + ex.name);
                }
            }
        }
        else {	// user edit mode. lock only the key fields
            for (var i in edittime) {
                if (jP.Form[edittime[i]].val() != "") {
                    try {
                        var thisitem = edittime[i];
                        $(jP.Form[thisitem].Item).find("input,select,textarea").attr("disabled", "disabled");
                    }
                    catch (ex) {
                        //alert(ex.message + " " + ex.name);
                    }

                }
            }
        }

    };
This works the same way under IE7 and Firefox 3.5.5

Disabled

 Pressing SUBMIT yields this:

OnErrorSubmit

Coordinator
Nov 30, 2009 at 6:05 PM

In SharePoint, a required field must have a value on submit.  Enabling/disabling does not change this fact.  Either make the field not required and do the non-blank check through code and provide error handling yourself,  or put a placeholder/default value in the field, like "To be completed," so when the field is enabled the user will know to change to the correct value.