I am using magento's inbuilt luma theme to practise and i am not able to understand where exactly is js written how is the flow ?

This is my basic view page. And is working fine i want to add jquery validation here.

<!---- Form  --->
<div class="container">
  <h2>Add Content</h2>
    <div class="form-group">
      <label for="email">Name</label>
      <input type="email" class="form-control" id="email" placeholder="Enter email">
    <div class="form-group">
      <label for="pwd">Post Content</label>
      <input type="password" class="form-control" id="pwd" placeholder="Enter password">
    <div class="checkbox">
      <label><input type="checkbox"> Remember me</label>
    <button type="submit" class="btn btn-default">Submit</button>
  • Sorry the form just did'nt get uploaded here , i strictly want add jquery validation where can i write ?? How is the flow pleae help !! – Abhishek More Mar 10 '17 at 13:01
  • The form is now displaying for you ;) – Ben Crook Mar 10 '17 at 13:12
  • Yeah ... :) I want to add jquery validation to it .. where should i place the code ? – Abhishek More Mar 10 '17 at 13:14
  • I haven't worked with validation on M2 yet so I can't answer sorry, this answer should help though - magento.stackexchange.com/questions/95171/… – Ben Crook Mar 10 '17 at 13:33

Please change your form tag with the below code and then check.

<form class="form contact"
  action="<?php /* @escapeNotVerified */ echo $block->getFormAction(); ?>"
  data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>"
  • I have a quik question what to write inside data-mage-init = '{ " validation" :{ ???????????? }}'> – Abhishek More Mar 11 '17 at 5:35
  • that was syntax for validation. nothing to write between that. – Gulshan Mar 12 '17 at 1:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.