Welcome to Our Community

Wanting to join the rest of our members? Feel free to sign up today.

Sign Up

Implement JS Validation Against A Required Field In A Pardot Form

Discussion in 'Graphic Design Forum' started by Yusuf Javed, Feb 17, 2021.

  1. Yusuf Javed

    Yusuf Javed New Member

    1. Code for Validating Input Box:
    if( $(this).find('. myclass ').hasClass('required') ){ if( $(this).find('. myclass ').find('input[type="text"]').val() == '' ){ // Write a js code to display error message against field } }
    2. Code for Validating Drop down field:
    if( $(this).find('.pd-select').hasClass('required') ){ if( $(this).find('.pd-select').find('select option:selected').val() == '' ){ // Write a js code to display error message against field } }
    3. Code for Validating text area:
    if( $(this).find('.pd-textarea').hasClass('required') ){ if( $(this).find('.pd-textarea').find('textarea').val() == '' ){ // Write a js code to display error message against field } }
    4. Code for validating check box:
    if( $(this).find('.pd-checkbox').hasClass('required') ){ if(!$('input[type="checkbox"]').is(':checked')){ // Write a js code to display error message against field } }
    5. Code for validating radio button:
    if( $(this).find('.pd-radio').hasClass('required') ){ if(!$('input[type="radio"]').is(':checked')){ // Write a js code to display error message against field } }
     

Share This Page