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
BedrockMission!

Learn More

View all

Sign in to view all badges

make a subform a read only

Avatar

Avatar
Level 1
jglitch
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
jglitch
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile
jglitch
Level 1

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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

Avatar

Avatar
Level 1
jglitch
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
jglitch
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile
jglitch
Level 1

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.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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

Avatar

Avatar
Level 1
jglitch
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
jglitch
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
View profile
jglitch
Level 1

03-06-2009

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

Avatar

Avatar
Validate 1
Level 4
Aditya_S_
Level 4

Like

1 like

Total Posts

315 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 4
Aditya_S_
Level 4

Like

1 like

Total Posts

315 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Aditya_S_
Level 4

21-12-2010

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

Aditya

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

21-12-2010