views:

14

answers:

0

Hi All,

i have a validation problem, where my code is refusing to pick up a textarea.

Error on var "fieldset = field.up("fieldset");" line:

this.showErrorMessageForMissingFields = function (missingFields) {
    var missingFieldPlaceHolder = $("missing-fields");
    var listOfFields = "";
    var fieldsets = {};
    for (var i = 0; i < missingFields.length; i++) {
        var field = missingFields[i];
        var fieldset = field.up("fieldset");

        fieldsets[fieldset.id] = fieldset;
        var label = this.getLabelForFieldId(field.id);
        if (label) {
            listOfFields += label.innerHTML.replace(':', '');
            label.addClassName('required-missing');
            missingFieldLabels.push(label);
        } else {
            missingFieldPlaceHolder.innerHTML += field.id;
        }
        if (i != missingFields.length - 1) {
            listOfFields += ', ';
        } else {
            listOfFields += '.';
        }
    }
    missingFieldPlaceHolder.innerHTML = listOfFields;
    $("error-block").style.display = "block";
    $("error-block").scrollTo();
    for (var fieldset in fieldsets) {
        if (fieldsets.hasOwnProperty(fieldset)) {
            fieldsets[fieldset].addClassName("error");
        }
    }
};

My text area is is complied from apex code

<apex:inputField id="software" value="{!controllerRequest.HEAT_Software__c}" styleclass="wide text"/>

and outputted in the source as:

<textarea class="text required" id="j_id0:requestForm:salesforce:extra-form-panel:changesrequired" maxlength="255" name="j_id0:requestForm:salesforce:extra-form-panel:changesrequired" onchange="handleTextAreaElementChange('j_id0:requestForm:salesforce:extra-form-panel:changesrequired', 255, 'remaining', 'over limit');" onclick="handleTextAreaElementChange('j_id0:requestForm:salesforce:extra-form-panel:changesrequired', 255, 'remaining', 'over limit');" onkeydown="handleTextAreaElementChange('j_id0:requestForm:salesforce:extra-form-panel:changesrequired', 255, 'remaining', 'over limit');" onkeyup="handleTextAreaElementChange('j_id0:requestForm:salesforce:extra-form-panel:changesrequired', 255, 'remaining', 'over limit');" onmousedown="handleTextAreaElementChange('j_id0:requestForm:salesforce:extra-form-panel:changesrequired', 255, 'remaining', 'over limit');" type="text" wrap="soft"></textarea>

Firebug tells me that my fieldset is undefined. as does the error. However this method works on another textarea which is exactly the same on another pgae.

Any suggestions?