Expand my Community achievements bar.

Group checkboxes

Avatar

Former Community Member
Hello Gurus

Is there anyway in livecycle designer to group checkboxes? I have a group of 10 check boxes where in I should allow users to select a maximum of 5 check boxes. If they try to check a 6th check box a message box should be displayed.
21 Replies

Avatar

Former Community Member
You will have to write code to know that only 5 of 10 have been checked. The product will allow you to do 1 of 10 but not more than that.

Avatar

Former Community Member
Thank you.



I am not able to group the checkboxes and every check box is named differently cb1 to cb10. the form should not allow user to select the 6th box and show an msgbox indicating so.



I would appreciate if any can provide some more details on how to go about writing the javascript in livecycle designer.

Avatar

Former Community Member
As it turns out I just came across a great blog (created by one of my colleages here at Adobe) that tackles this very subject. There are a number of good samples that show how to do this. It is complicated code but you should get the gist of it.



Here is the link. Let me know if you find it helpful.



http://blogs.adobe.com/formfeed/



You will want to look at the discussion of exclusion groups (1,2 and 3)

Avatar

Former Community Member
Thanks Paul..I created a completely new form with 3 checkboxes.



I created a script object and created the "utility" script object provided in the example. And for the subform "initialize", i wrote the following java script. utility.setMinandMax(this,1,2)..



So I was expecting that I will only be able to select 2 checkboxes at the max, but the form is allowing me to select all the 3.



Much appreciate your help.

Avatar

Former Community Member
Ok, I got this working by creating a library object of the 'subform' from one of the samples. I then did a drag n drop of the subform into a new blank form and added a few checkboxes. From the heirarchy window, I added a script object given in the sample and named it 'utility' and that's all..everything works great.



However I am not able to implement this into my original form I have been working with. Iam not able to drag the subform object that I earlier added to my library as it appears disabled. This could be because that pdf Iam working with has earlier been imported from a word document. Some of the disabled objects include the "text" object..



Thanks so much for your help!!

Avatar

Former Community Member
Send the form to Livecycle8@gmail.com and I will have a look.

Avatar

Former Community Member

Hi. I have the same limitations I'd like to place on the festival entry form I'm creating. I have categories of performances(vocal, musical theatre, theatre, dance, and instrumental) that teens can choose from, but I have to limit their selections to 2. I'm a graphic designer in Quark, Illustrator and Photoshop; I don't know code! Thanks for any help.

Avatar

Former Community Member

So instead of having checkboxes that you want to limit to 2 selections (you will have to write code to accomplish this), why not put the selections in a Dropdown list. They can only choose one item in the list but you could have 1st performance and 2nd performance dropdowns.

Make sense?

paul

Avatar

Level 4

Humm

I am not sure how your overgiven values look like. If you overgive 1 as clicked and 0 as unclicked, why don't you make an invisible decimalfield couting up all your checkboxes. I think that method is quite easy...

(Javascript calculate)

Decimalfield1.rawValue = Checkbox1.rawValue + Checkbox2.rawValue etc.

(Look that you got the correct names)

In the checkboxes you simply add the line (Javascript/change):

if (Decimalfield1.rawValue > 2) {this.rawValue = null; }

The cross will vanish then... You could add an app.alert if you'd like...

Hummhumm...

Maybe I'll make later another post because I've got a problem too with these grouped checkboxes... (in my case at least 1 option has to be checked... and I am just thinking how to invoke a nullTest = "error")

But after I thought a bit about it... most likly I can do it myself

Nope... sorry... bad idea, didn't work...

The problem: I'd like to script if none of a group of checkboxes is clicked, there should be a nullTest = "error";

The real problem is not to evoke the nullTest = "error" but that I am not sure, if in some versions of AdobeReader there might be a hint, which field(s) did evoke that error...

Right now I want to create an invisible field that will get mandatory if one of the groups has no checks and get optional if they are all checked...

Or is there any possibility to get the message turning up with script only?

Avatar

Level 7

Hi ocen,

You could put a script on preprint or presave simply checking the box you want mandatory if all checkboxes are null.

Avatar

Level 4

@djaknow

Doesn't work.

1) I don't wanna check any boxes.

2) Have you tried to mail it? I did... what happened: The Checkbox got a red border (memo: third kind of border I've seen at a checkbox) and the mailbox opened... no error message at all.

3) I printed maaaaany forms without the mandatory boxes filled ;D (Luckily the ones I make these forms for don't want print validation, just the xml scheme.)

4) Even if I provoke an error message (no problem doing so) I am not sure if there is no version of LCD which will give a hint to which field is not filled out.

And that is what I am afraid of since I just had some problem with different AdobeReader versions...

If someone could tell me that I don't have to stress myself about point 4 it won't be any problem.

Avatar

Former Community Member

Thanks for replying, but I don't understand anything in your message. Could you translate it for someone who doesn't program?

Randee Leightcap

Graphic Artist

rleightcap@aclsys.org

Atlantic County Office of Cultural & Heritage Affairs

40 Farragut Avenue, Mays Landing, NJ 08330

(609)625-2776, extension 6339, FAX (609)625-5908

www.aclink.org/culturalaffairs

Atlantic County Library System, Community Relations Section

306 E. Jimmie Leeds Road, Galloway, NJ 08205, (609)652-1956, FAX (609)652-1863

www.atlanticlibrary.org

Avatar

Level 4

Here... isn't the best solution but it is one.

I liked to have a look at your form... learned a little thing ;D

(If you want another question to appear, just change it in the scripts...)

Hope my question will be answered soon too.

Avatar

Former Community Member

Thanks for the solution! I'm not picky about free help! And thanks for the advice on the mandatory fields. I don't feel anywhere near where to send it, so I hadn't tried to email it yet. I'll try to be very careful about the wording of the error messages.

Randee Leightcap

Graphic Artist

rleightcap@aclsys.org

Atlantic County Office of Cultural & Heritage Affairs

40 Farragut Avenue, Mays Landing, NJ 08330

(609)625-2776, extension 6339, FAX (609)625-5908

www.aclink.org/culturalaffairs

Atlantic County Library System, Community Relations Section

306 E. Jimmie Leeds Road, Galloway, NJ 08205, (609)652-1956, FAX (609)652-1863

www.atlanticlibrary.org

Avatar

Level 4

@rll111

Try to understand the codings you have just a little bit. With these you can do quite much in a form already.

If you ever wanna do more forms you'll have to learn it at least a little bit. ^^

@djaknow

Sorry if I sounded rude... I'm more mad about myself... I was content with my solution (which was MUUUUUUCH more difficult to conceptionate than yours), just to see when the form is opened with another version of the reader I got doubled borders...

(A problem that appears with radiobuttons is, that if they are mandatory in flowable forms the border will show up in higher versions of the AdobeReader and hide in the lower ones. Since I dislike that huge border around everything I wanna make small ones. Lots of requests to those small radiobuttons I know... but it all wouldn't be a problem if I could be sure that no Reader version would give a hint to which field is not filled out.)

Avatar

Level 7

Hi ocen,

Don't worry about the rude thing, I know how frustrating it can be trying to pull a solution out of thin air.

As for the radio buttons, have you considered using checkboxes and scripting them to be mutually exclusive like radio buttons? All it takes is:

if (this.rawValue == 1) {

     otherCheckBox1.rawValue = 0

     otherCheckBox2.rawValue = 0

     etc.....

}

This is the method I use for exclusion groups. I find it much easier to script other dependencies (such as making text fields open/readOnly) on checkboxes rather than using radio buttons.

Avatar

Level 4

Yeah I know a bit about this exclusiongroupthingy... the problem is making them mandatory...

The problem gets worse since I don't know if the fields (and error-messages) will react in all versions of adobereader the same way.

(There the problem began to begin with... the borders of mandatory radiobuttons appear in older versions in another way than in newer versions of adobereader.)

I made a new thread for this... only thought if I'd be lucky ppl could answer here, because it's both about those checkboxgroups......

Avatar

Former Community Member

Paul, Thanks for the suggestion. Would I still be able to make the appropriate subform become visible when the selection was made from a dropdown list?

Randee Leightcap

Graphic Artist

rleightcap@aclsys.org

Atlantic County Office of Cultural & Heritage Affairs

40 Farragut Avenue, Mays Landing, NJ 08330

(609)625-2776, extension 6339, FAX (609)625-5908

www.aclink.org/culturalaffairs

Atlantic County Library System, Community Relations Section

306 E. Jimmie Leeds Road, Galloway, NJ 08205, (609)652-1956, FAX (609)652-1863

www.atlanticlibrary.org

Avatar

Former Community Member
The form was converted from PDF through MSword. that's the reason i was unable to edit any text or add a custom object. I reconverted the original MS word using livecycle designer and everything works fine now. The checkbox exclusion groups works great too!!



Thanks so much for your help.