Category: Javascript

Q: jQuery validation and CakePHP not working together

I want to use jquery validation and CakePHP together.

<?= $this->Form->create($email, ['url' => ['action' => 'newEmail']]); ?>
<?= $this->Form->input('email', ['required' => 'required']); ?>
<?= $this->Form->end(); ?>
<script>
$("#emailform").validate();
</script>

But it doesn't work in my app, what should I do to fix the problem? 

jquery
1 Answers

Version: 3

In my experience, you have to add an id attribute in HTML form tag:

<?= $this->Form->create($email, ['url' => ['action' => 'newEmail'], 'id' => 'emailForm']); ?>
Luke
Luke

3

Created: 20 Oct '16

Last Reply: 24 Oct '16

Replies: 1

Views: 1078

Votes: 0

Welcome to Aero Coding!

Aero Coding is a CakePHP-focused Q&A community for professional and enthusiast cake bakers. It's built and run by you as part of the community.


Join Now Tour

Download Cakephp

Start baking your own CakePHP application!


Cakephp All Versions