Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Mandatory message

Avatar

Former Community Member
Hi,



I have a required field in my form while submitting an alert message is displayed as "Atleast one required field was empty on export, please fill the highlighted fields before continuing" but i dont want this message to be displayed,i want to display an appropriate message. i tried my giving this.mandatoryMessage.This message gets displayed and then again the message "Atleast one required field was empty on export, please fill the highlighted fields before continuing" appears. how to disable that default message or alter the message?



Rgrds,

Sangeetha
2 Replies

Avatar

Former Community Member
yeah i dont like it either!



I use a script (on the submit button) that loops through all fields in a subform & checks whether fields are required & are equal to their default value (i.e. have not been filled in / changed) - I don't know why that default message doesnt come up anymore even though that was my aim when i wrote the script in the past. (my memory's not too good!)



(by the way.. the variable "allFields" is the nodes of the subform you want e.g. subform.Nodes)



I dont know a way of doing this for the whole form, so what I do is



write this function for each subform in the form i.e.



checkRequired(subform1.nodes);

checkRequired(subform2.nodes); etc..



(I alert the caption because our field names are too weird)

**************************************************************



function checkRequired(allFields)

{

var testerror = "false";

var nNumNodes = allFields.length;



for (var i = 0; i < nNumNodes; i++)

{

var oNode = allFields.item(i);



if ((oNode.className == "exclGroup") && (oNode.validate.nullTest == "error") && (oNode.rawValue == "") ||

(oNode.className == "field") && (oNode.validate.nullTest == "error") && (oNode.rawValue == null))

{

app.alert("The following required field has been left empty: " + oNode.caption.value.text.value);

}

testerror = "true";

break;



}



}



if it doesnt work, im sorry

Avatar

Former Community Member
I found this to be helpful for my case. My requirement is to validate fields, based on values entered into other fields. This technique seems to work well for my app.



http://blogs.adobe.com/formbuilder/2006/08/complex_validations.html