On button click manipulate 2 objects

121 views
Skip to first unread message

Jane House

unread,
Dec 9, 2014, 5:06:09 PM12/9/14
to comman...@googlegroups.com
I have a subpage created and a button that shows it. But, on that button click I want to manipulate two objects - show subpage and hide text. Is there a way to do that in JavaScript? If so, how do I  reference these objects (at least the subpage has a name, but my text doesn't)?

Thanks!

Jarrod Bell

unread,
Dec 9, 2014, 5:11:24 PM12/9/14
to comman...@googlegroups.com
You reference objects by their join numbers.
So if you want to show/hide a subpage, you do so via its digital join.

CF.setJoin("d10", 0);

That little script would hide a subpage on digital join 10.

CF.setJoin("s2", "");

That script would set a text object on serial join 2 to an empty value.

Then you can combine them as easy as this, and place the script into the button JavaScript properties:
CF.setJoin("d10", 0); CF.setJoin("s2", "");


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


On 10/12/2014 9:06 am, Jane House wrote:
I have a subpage created and a button that shows it. But, on that button click I want to manipulate two objects - show subpage and hide text. Is there a way to do that in JavaScript? If so, how do I  reference these objects (at least the subpage has a name, but my text doesn't)?

Thanks!
--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jane House

unread,
Dec 10, 2014, 3:06:50 PM12/10/14
to comman...@googlegroups.com
Thanks, it's working!

Is there a library of allowed JS functions? Where do I find these? Particularly interested in dynamically flipping button states from Inactive to Active, etc.

Barry Gordon

unread,
Dec 10, 2014, 3:49:47 PM12/10/14
to comman...@googlegroups.com

I can't tell if you are new to JS but good for you for at least attempting it. The JS engine that CF uses is the one supplied in the iPad. I think it is ECMA 3. The allowed JS functions are whatever JS allows.  I think you may be wanting to know what are the CF. functions. 

 

Those are well documented in the scripting reference document at  http://www.commandfusion.com/docs/scripting/  and in the CommandFusion.wiki at http://www.commandfusion.com/wiki2/.

 

I suggest you use the scripting reference to see how to include JS modules, into CF using the script manager. As my father used to tell me (constantly) :

                Every man (woman) has the wit to know and the will to learn, but the key to knowledge is the open book. or in this case the open Web page.

 

The CF functions are merely an object in the JS namespace provided by CF, and all of the "CF functions" are functions in the name space.  When you build JS modules it is IMHO a good idea to follow the CF lead and build all your FS modules as objects with some simple name (I use 2 to 3 capital letters) The advantage of this is that you can reuse names in the various JS objects. e.g. each object (module) can then have a function called initialize with no naming conflicts.  Naturally the addressing must include the name of the object as in MY.initialize(). or AB.initialize().  The name of the module can be anything you want, it is used by the script manager to desigane what modules to load at run time.

 

A single module can have many objects but I generally place one main object in each module as an all encompassing object with objects needed by the module as objects in the encompassing object.  Buttons then can make calls such as MY.action(button_join_, another Parameter, another parameter, . . . ).  I find this more convenient than putting complex JS snippets on a button. Also it allows me to syntax check more complex JS snippets before they are used.

 

Hope that helps. 

--

Jarrod Bell

unread,
Dec 10, 2014, 5:05:52 PM12/10/14
to comman...@googlegroups.com
Button states are also controlled via digital joins of the button. So CF.setJoin("d10", 1); would set button on digital join 10 high.



Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
Reply all
Reply to author
Forward
0 new messages