Highlighted

make a subform a read only

Avatar

Avatar

jglitch

Avatar

jglitch

jglitch

03-06-2009

Hi all,

I'm new to scripting, a sample code will help.

I have a form with three subforms in it. One subform (subform1) contains radio buttons, radiobutton1 & radiobutton2. When radiobutton1 is selected, I need to disable subform 2 and all its elements. Same thing when selected radiobutton2, subform3 and all its elements are disabled.

How do I do this?

Any response is helpful.

Thanks.

J.

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

03-06-2009

The radio buttons will be part of a RadioButton group. On the change event of that group you will add your code there. If you query the group object it wil return the value of the button that is selected. So if you have one button for Yes and one button for  No (and you have set them up to return those values, then you can use code something like this:

if (this.rawValue == "Yes"){

   subform2.presence = "hidden";

} else {

   subform2.presence = "visible";

}

You can also set the presence to invisible and the subform space will still be there (blank of course). Hidden will exclude the subform from the layout and if the form is created properly will reflow so there is no blank space. Make sure to save your form as a dynamic form.

Paul

Highlighted

Avatar

Avatar

jglitch

Avatar

jglitch

jglitch

03-06-2009

Thanks Paul.

With  your script, it hides the subforms with a selection of a radiobutton.

I don't want the subforms to be invisible. I need to just disable the elements in the subform.

I tried your code that you have sent me by I can't figure it out (dumb to scripting, especially the "for loop").

Thanks.

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

03-06-2009

The code is set up to accept a subform and will lock everything in that subform. So you shoudl be able to make a call to the scriptobject and pass the subform name (complete path) that you want to lock so something like this (your path will be different). The original command looked like this:

myScriptObject.LockAllFields(form1);

Modify to look like this:

myScriptObject.LockAllFields(form1.Page1.subformName);

Make sense?

Paul

Highlighted

Avatar

Avatar

jglitch

Avatar

jglitch

jglitch

03-06-2009

got it! thanks paul. you're the genius!

Highlighted

Avatar

Avatar

Aditya_S_

Avatar

Aditya_S_

Aditya_S_

21-12-2010

Paul - Can you please send me that code....

Aditya

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

21-12-2010