Forums

Javascript error

Pistone 11 Jul, 2017
Hi i trying to create a form with chronoforms,
but in browser console i receive always this error.
e5cbf2c….js:338 Uncaught TypeError: Cannot read property '0' of undefined
at this line of code.
if(jQuery(inp).data('validationrules')['rules'][0]['type'].indexOf(r) >= 0)

The same thing hapens with the demo basic template.

Waht i can check to solve this issue?
Thanks in Advance
GreyHead 13 Jul, 2017
Hi Pistone,

I haven't seen this before, please post a link to the form so I can take a look.

Bob
Pistone 21 Jul, 2017
1 Likes
Hi GreyHead,
i've found the bug that cause the error.

This is the html code created from field.php:
<input data-validationrules="{" identifier":"nome-main","rules":[{"type":"required","prompt":"nome"}]}"="" data-validate="Nome-main" data-events="[]" placeholder="Nome" name="Nome" id="Nome" value="" type="text">


with this line of php code:
$Html->attr('data-validationrules', json_encode($validate_tag));


the error is this: data-validationrules="{", the second double quote close the data validation-rules attribute, this explains the javascript error.

Modifing hte code line in:
$Html->attr('data-validationrules', htmlspecialchars(json_encode($validate_tag)));

the form works like a charm.

Hope this helps all the other user with similar issues...

Bye.
Max_admin 27 Aug, 2017
Hi Pistone,

Thank you, a fix has been applied to the issue in v6.0.7

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.