Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Check if radio button is required

Avatar

Not applicable
I am trying to parse through all the fields on the form and see if its reqd and filled. If its reqd but not filled , show an error message. I am able to do so for text fields and drop downs but not for radio buttons.



I tried checking if its a subform and combing in a loop to see if the fields are filled. Is there any reason why radio buttons could not be checked that ways. I tried specifying "exclGroup" or "subform". It still doesnt catch it.



Here is the code I am using:



function checkFields(oNode)

{

var flag =0;

if (oNode.className == "exclGroup" || oNode.className == "subform")

{

for (var i = 0; i < oNode.nodes.length; i++)

{

var oChildNode = oNode.nodes.item(i);

if(oChildNode.validate.nullTest == "error" && oChildNode.rawValue == null)

{

xfa.host.messageBox("Please specify the " + oChildNode.resolveNode("caption.value.#text").value + ".");

var str = "xfa.form.form1.pg1."+ oChildNode.name;

xfa.host.setFocus(str);

flag = 1;

return;

}

}

}

if(flag ==0)

return true;

return false;



}



Thanks for your hlep.



Shweta
0 Replies

Avatar

Not applicable
Ok I got this..I was just checking for null to see if it is empty I needed to do

if(oChildNode.validate.nullTest == "error" && oChildNode.rawValue == null || oChildNode.rawValue == "" )



But in the message box I am not able to display the radio Button's caption. I use:



xfa.host.messageBox("Please specify the" + oChildNode.resolveNode("caption.value.#text").value + ".");



It displays only "Please specify the."



My radioButton List is named Choice with Yes and No as radio Buttons. I guess it is looking for caption of Choice, rather than Yes/No. It is setting the focus correctly though.



Could any one please tell as to how to get the captions of the radio buttons.



Thanks

Avatar

Not applicable
Hi Shweta,



It would be very helpful to us if you could post the function call for this solution. What object are you passing as a parameter? Of course it would be even better if you could attach an example of the solution.



Thanks in advance,

Annika

Avatar

Not applicable
Hi again!



The problem is solved, we just needed to pass the page instead of the form.



Thanks!

Annika