hi, I am working on a custom stamp that has a dialog popup before stamp is applied. The dialog has 2 sections containing groups of radio buttons. The user must select one of the radio buttons in each group. When I validate however it only validates the first group. If I put the validation code of the second group first, then it only validates the second group. So basically it validates a group, then returns either true or false, and does not proceed to the second validation.
I tried only returning false after the second group - this almost works - it does validate both if both are false (I get 2 alert boxes with the correct messages), but if the first group is set to true, it returns true and exist without running the second part.
the closest explanation I can find is that I need to add a 'name' attribute to my input fields - however that is for html... my radio buttons do have a name though. Any ideas? Here is my validation code.
sd.validate = function(dialog)
{
var res = dialog.store();
for (var i = 0; i < this.builder.radioButtons1.length; ++i)
{
var c = this.builder.radioButtons1;
var id = "rad1" + i;
if (res[id] == true)
return true;
}
app.alert(this.builder.radioErrorMsg1);
return false;
var res = dialog.store();
for (var i = 0; i < this.builder.radioButtons2.length; ++i)
{
var c = this.builder.radioButtons2;
var id = "rad2" + i;
if (res[id] == true)
return true;
}
app.alert(this.builder.radioErrorMsg2);
return false;
};
----------------and here is the global script defining the groups
radioGroup1 : "Constructed",
radioButtons1 :
[
{ value:"WithRedlines", description:"As-constructed, with redlines"},
{ value:"NoChanges", description:"As-constructed, no changes" },
{ value:"OutOfScope", description:"As-constructed, with redlines, out of scope" }
],
radioErrorMsg1 : "Please select an as-constructed value.",
radioGroup2 : "Redlines",
radioButtons2 :
[
{ value:"Contractor", description:"Contractor Redlines"},
{ value:"Inspector", description:"Inspector Redlines" },
{ value:"Comissioning", description:"Comissioning Redlines"},
{ value:"Other", description:"Other Redlines" }
],
radioErrorMsg2 : "Please select a Redline type."
----------------------and here is the dialog builder that assigns a name to the radio buttons
typeElements =
{
type: "radio",
name: c.description,
item_id: "rad2" + i,
group_id: "grp2"
};
----------any thoughts?