Clickable counter

al aleksinverstas332 26 Oct, 2025

I'm building a form where i have two fields that are updated mathematically with PHP.Update happens by button that calls PHP that reads value from a field and counts addition to that.Now problem is that it works one time and updated value comes visible to the field in form but second press of the button does not do anything.

Very simple PHP

$maara = $this->data("ss_maara", "default");

$maara = (int)$maara + 1;

return "$maara";

It seems that even first click updates the value in the field "ss_maara" and PHP reads value on first call somehow second call receives oroginal value that was set as default. I'm not familiar with PHP so most propably it is somehow my mistake.What should be done so that udated value goes to the script on second click? 

Max_admin Max_admin 27 Oct, 2025

how do you want this form to work ? do you have an online example of how this form should behave ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
al aleksinverstas332 27 Oct, 2025

Not yet publically available.

I have data field with numeric value, alias "ss_maara".

And button. What i want to archieve is that when button is clicked. Datafield value increments by 1.

Button has trigger "ss_add". Field "ss_maara" has listener for "ss_add" Listener calls {var:add} that is the php script.Php is expected to receive value from "ss_maara" Increment value by one and then return new value to the "ss_maara" value.Visually this happens one time, but {data:ss_maara} seems to stay unchanged. Hence value in field increments only one time.How to get {data:ss_maara} updated ?

Aleksi

Max_admin Max_admin 16 Nov, 2025

Hi Aleksi

You can increment a JavaScript variable using a JavaScript function call on button click OR you can increment a server variable using an AJAX call also on button click, the click event can be listed to using a Listener

What do you want to do ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Post a Reply