-4

I'm trying to integrate parsley.js to my dynamic from. When I click the submit button which triggers an event in the javascript I call

var validateForm = $('#myForm').parsley().validate();

But it wont work since in the console theres an error

Uncaught TypeError: Object 73 has no method 'replace'

Object 73 seems to be the radiobutton field (I guess - correct me if it isnt that). Generated it looks like this:

<span class="formw">
   Test1<input class="formField data-parsley-required" prop="text" type="radio" name="73" value="Test1" data-parsley-multiple="73" data-parsley-id="0256">
   Test2<input class="formField " prop="text" type="radio" name="73" value="Test2" data-parsley-multiple="73">
   Test3<input class="formField " prop="text" type="radio" name="73" value="Test3" data-parsley-multiple="73">
 </span>

I really dont know how I can get parsley to work in my form and fix this replace error...

any help would be appreciated!

thanks in advance

pythoniosIV
  • 237
  • 5
  • 18

1 Answers1

4

I suppose Parsley don't support data-parsley-multiple or name that are pure numbers. It tries to make a str.replace() and this is not a string.

Try to use a string instead, like data-parsley-multiple="radio73"

Best

guillaumepotier
  • 7,369
  • 8
  • 45
  • 72
  • thanks for your answer beside all the negative votes! Now I realized that the problem is the number in the name. Sadly I can't change that, because in the backend I need these values in the name, otherwise I would need to change the whole logic. But really appreciate your answer! Looks like I have to look for something else beside parsely :) – pythoniosIV Apr 01 '14 at 14:30
  • Maybe you need to keep 73 for the id or the name. Fine. But **nothing** in the backend force you to keep that value for data-parsley-multiple. You can set your own data-parsley-multiple value to your inputs and then call parsley – guillaumepotier Apr 01 '14 at 21:18
  • With "in the backend" I meant to say my logic for my application which is in the backend and not the parsley backend, I'm sorry if I didnt express it clear enough. thanks anyway :) – pythoniosIV Apr 02 '14 at 06:43