Hello,
I've created a form using Chronoforms specifically to take advantage of the validation features. Everything is working great and I'm thrilled with this component, however would like to validate a field called "charge_total" to require the dollar format of 0.00 (no $, and two decimal places).
This form posts to a 3rd party hosted pay configuration for credit card processing, and the provider requires the charge_total field be in the 0.00 format in order for the transaction to complete.
help is much appreciated, my javascript coding is minimal.
m
hi md520,
then this should be done using a custom rule, make sure you know the field_id and use this code in the JS code box
window.addEvent('domready', function() {
var amount = new LiveValidation('amount');
amount.add( Validate.Format, { pattern: /^[0-9]\.[0-9][0-9]+$/i } );
});
//I assumed that the field id is amount
you will probably need to use a similar rule in the Server side validation box to securely stop anyway to pass any other value!
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Thanks for the quick reply. I inserted the code into the js box, changing the field value from amount to charge_total, which is the proper field, however I cannot get it work - do I need to add any additional brackets/code?
The following code is also in the javascript box, <SRC="//smarticon.geotrust.com/si.js"> but even if I remove it I cannot get the validation to work.
Also, you mentioned I'll need something "similar" in the server side scripting box, however I am not trained in any server side scripting- can I copy and paste the same code in there, or does it need to be something different?
Thanks again for the great component and support.
Hi, lets get the JS code working first, show me what you have in the JS box and show me the field HTML code and tell me which Chronoforms version do you have ?
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
ok, remove the charge_total from the validation field and make your code like this:
window.addEvent('domready', function() {
var charge_total = new LiveValidation('charge_total');
charge_total.add( Validate.Format, { pattern: /^[0-9]\.[0-9][0-9]+$/i } );
});
<SRC="//smarticon.geotrust.com/si.js">
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
ah - sorry for wasting your time with that one - I can't believe I missed that var amount replacement.
Nevertheless it is still not working, can I pm you the full code and site access?
thanks
well, try to remove the last line with SRC then, I'm not sure if this is correct one!
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
still no luck, with the SRC line of code removed. When I press the submit button, with a value fo "5" in the charge_total field, it progresses to the 3rd party hosted paypage.....I assume that when the validation is working properly it will not allow me to go to that page until the number reads 5.00. All the other validations work great.
Any other ideas? I appreciate the help and will be voting for your component on joomla extensions once I have this figured and some more time.
your field tag doesn't have an id attribute, please add it and it will work fine, just tested it here!
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
hmm, I see, please get the RC5.2 which I will release in the next few hours and retest using it, the upgrade is very easy
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?