trigger calc only if element validated

ontarget

Active Member
Hi I am using a calc element to grab a group of elements and turn them into a bitly link.
The calc is using ajax and is creating the bitly link before any elements have been populated.
Is there any way of stopping a calc element from running until a few elements have been populated / validated?
Thanks
 
No. Not directly at least.

But the calc element is running php, and the php can return an empty string if there is insufficient input to create a correct bitly link.

I will leave it to others to comment on whether it is possible to stop the calc ajax from being fired by JS change events.
 
I will leave it to others to comment on whether it is possible to stop the calc ajax from being fired by JS change events.

That's kind of a all or nothing thing. If you enable AJAX calc, it'll fire whenever one of the referenced elements changes.

But yeah, just code the calc so it doesn't call the bitly API if all the parts you need aren't empty.

Altough tbh, I wouldn't use a calc for this, I'd use a form submission script, running onBeforeProcess, to make sure you only call bitly once.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top