How to add an onclick Event Object to a checkbox

manualva 20 Apr, 2014
How to add an onclick Event Object to a checkbox. I'd like to use the checkbox element provided by chronoforms since I'm having problems with a set of checkboxes I created using "Custom Element (HTML/PHP)". It's a workaround that I found to solve a bigger problem, which if you like to read on and give me any other suggestions I'd be happy to hear and try them out...

Firstly, my form is a Multi Page form. These checkboxes I've created call to a javascript code I created in a Load JS event. This javascript code basically calculates the values of these checkboxes and gives me a final number (theres addition and multiplication). When I press Next Page button, I have an invoice-like form that shows me the checkboxes I've selected with they're respective values. The problem is, if a client decides to remove or to unselect a checkbox and hits previous page, unselects the desired checkbox and hits Next Page again, the invoice-like form doesn't show the update. Once you've checked a checkbox and click on the Next Page button that checkbox remains "checked" until you close the browser and clear temp files or whatever. I'ts difficult since I really can't see or debug this "ghost" data.

I found that using the checkbox element provided by chronoforms is a more code-friendly approach to solve this updating between multipage forms problem. This checkbox element however doesn't provide me with a field for an onclick event where I can communicate to my javascript code to calculate values. Anyways, any help is greatly appreciated.
Max_admin 20 Apr, 2014
Hi manualva,

It looks like you are using v4, I'm not sure how do you set the checkboxes events, but you can try to add a specific class to your checkboxes group and use it as a selector inside the JS function which can be executed in the dom ready event!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
manualva 24 Apr, 2014
Hi!

The onlcik event must be called for my calculator to work. The specific class you are referring to IS called, but in my case it's not a class it's an ID.

If adding an onclick event to the checkbox provided by chronoforms is not possible, then is it possible to refresh data everytime I refresh the browser in a specific page in a multipage form so that the data entered and passed when clicked on Next Page button would just reset? Like a clear session and reload new session sort of event, for a specific page of my multipage form, leaving some multipage pages intact? Thanks in advanced!
manualva 24 Apr, 2014
Answer
Ok... I've decided to use my custom code in "Formatted Text" element, instead of using "Custom Element (HTML/PHP)". For my purposes, this makes my multipage form behave and perform much better when it comes to reloading and/or passing data inputs from page to page. I believe my problem is not in data input passing, since the Debugger shows the update between pages with absolutely no errors. I believe now the problem is in the invoice-like form I've created in the Show Thanks Message event display at the end of my form. Thanks for the help guys! I believe this problem is solved.
This topic is locked and no more replies can be posted.