11 Replies Latest reply on Mar 19, 2008 6:26 AM by Ramon F Herrera

    Does JavaScript support cascading events?

    Ramon F Herrera Level 1
      I am obviously referring to Adobe's implementation of JS.

      It seems that cascading/hierarchical events are not supported.

      Let's say I have 5 mutually exclusive radio buttons. It looks like I can attach an action only to the "positive" clicking of a button. I would like to be able to attach actions to the automatic unclicking which affects the other n-1 buttons.

      I can do that with C/C++ and Java...

      Perhaps this is a limitation of the Acrobat GUI?

      -RFH
        • 1. Re: Does JavaScript support cascading events?
          Patrick Leckey Level 3
          Acrobat JS complies with ECMA-262 3rd Edition (roughly JavaScript 1.5).

          If you're using an XFA form, use the "change" event on the other radio buttons. In an AcroForm use the "calculate" event. In both cases those will fire in when they are unselected by virtue of selecting another radio button in the group.
          • 2. Re: Does JavaScript support cascading events?
            Ramon F Herrera Level 1
            > In an AcroForm use the "calculate" event.

            This suggestion really sounded promising. However...

            http://patriot.net/~ramon/Text-vs-Radio.png

            -RFH
            • 3. Re: Does JavaScript support cascading events?
              Patrick Leckey Level 3
              Hmm, seems you're right. With AcroForms at least. I design all my forms with XFA these days, so I forgot that radio buttons don't support the calculate event. Will work with XFA forms though.
              • 4. Re: Does JavaScript support cascading events?
                Ramon F Herrera Level 1
                > Will work with XFA forms though.

                It seems that the writing's on the wall from Adobe: "Move to XFA or else...". Another feature that I really like, and seems to be available only through XFA is the cool way to input dates.

                I am still hesitant about making the jump to XFA. For one thing, the Live Cycle Designer is buggy (it has crashed on me), unpolished and it needs a lot of horsepower.

                -RFH
                • 5. Re: Does JavaScript support cascading events?
                  Ramon F Herrera Level 1
                  > I design all my forms with XFA these days [...]

                  Oh, in case I haven't complained enough about XFA, here's another one. This is a biggie, a show-stopper for me.

                  Most of my work is done on forms that already exist on paper, and I have absolutely no control on their design. Those forms are called "static" by LiveCycle. With the traditional AcroForms, I simply import some scanned image and then I place the fields neatly on top of the existent paper features, but not so with XFA with is "too cool for school" and has a mind of its own when it comes to look & feel, size and placement.

                  Adobe should offer two classes of fields, I would name them "followers" and "leaders", for obvious reasons.

                  -RFH

                  "You have 3 choices: you may either lead, follow, or stay out of the way..."
                  • 6. Re: Does JavaScript support cascading events?
                    Patrick Leckey Level 3
                    I don't understand what you mean by that. Also your understanding of "static" and "dynamic" forms seems to be a little off. You can place and size form fields in LiveCycle Designer just as you can with Acrobat, even on top of scanned paper forms. And those forms can be dynamic forms too.

                    "Just because you don't know how to use the features doesn't mean they don't exist."
                    • 7. Re: Does JavaScript support cascading events?
                      Ramon F Herrera Level 1
                      > Also your understanding of "static" and "dynamic" forms seems to be a little off.

                      Well, let's review it. Static forms have some sort of bitmap on the background, which can be a bucolic scene from a Swiss mountain, or, more likely, some boring characters, check marks, horizontal lines to be filled with text, empty tables, etc. A scanned IRS form is a good example. They are called "static" because Acrobat pretty much has no knowledge or control over the image in the background. They are like the Tahitian beach on your desktop.

                      "Dynamic" forms, well, not static: they are editable and their text can be moved around, etc.

                      Static backgrounds come from Photoshop (or from a scanner), dynamic ones from Illustrator.

                      -RFH
                      • 8. Re: Does JavaScript support cascading events?
                        Patrick Leckey Level 3
                        Well, by Adobe's definition ... no. Static and Dynamic has nothing to do with background image types, etc. It's all about flowed and growable layout.

                        From the XFA Specification 2.7 (I've given you a link to these documents in another thread):

                        Static Form:
                        An XFA form that has a set number of subforms.
                        Unlike dynamic forms, static forms cannot add
                        subforms to accommodate additional data.

                        Dynamic Form:
                        An XFA form that automatically adds containers
                        and rearranges its layout depending on the data
                        being entered into it. In a dynamic form, the
                        arrangement of the form is determined by the
                        arrangement of the data supplied to the Form
                        DOM. A dynamic form is enabled by an XFA
                        template that specifies subforms that may be
                        replicated, depending on the data supplied to the
                        Form DOM.

                        Nowhere in those definitions does it make mention of imported art or background types. If your definition relies on background types, what type of form would something with no background be? And you most certainly can add a JPG or PNG as a background in a dynamic form.
                        • 9. Re: Does JavaScript support cascading events?
                          Ramon F Herrera Level 1
                          > It's all about flowed and growable layout.

                          Thanks for providing the formal definitions.

                          My observations are based on a very simple fact:

                          Users normally prefer to keep a correspondence between the square check mark in the background (the paper widget) and the blue computer widget on the foreground.

                          A static background implies a static set of fields.
                          A dynamic background implies a dynamic set of fields.

                          What I am referring to is just rules of thumb, business practices.

                          OTOH, people may wear a tuxedo to go scuba diving. It's not illegal.

                          > what type of form would something with no background be?

                          That would be dynamic: as there is no background to anchor your widgets you may move your widgets around. You can accommodate not only the underlying text but the widgets. That's called dynamic.

                          -RFH
                          • 10. Re: Does JavaScript support cascading events?
                            Patrick Leckey Level 3
                            > What I am referring to is just rules of thumb, business practices.

                            That terminology is defined in the XFA Specification, it's not a "rule of thumb". XFA Forms are split into two types: static and dynamic. When you go to "File > Save As ..." in LiveCycle Designer two of the options will be to save as a Static Form or a Dynamic Form.

                            Once again, you really need to read the documentation before you go complaining about missing functionality that in fact already exist, misusing terms that are specifically defined in the subject matter at hand and generally asking questions that are plainly answered by having read even a small amount of the available documentation. At this point that may be expecting too much of you though.
                            • 11. Re: Does JavaScript support cascading events?
                              Ramon F Herrera Level 1
                              Sorry by taking some time to answer, as I am busy reading the documentation. :-)

                              -RFH