Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Select Mandatory Customer Input Fields for Certain eStore Products

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Select Mandatory Customer Input Fields for Certain eStore Products

Tagged: custom input, customer input, customer input fields, required fields

  • This topic has 5 replies, 2 voices, and was last updated 9 years, 2 months ago by admin.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • March 11, 2016 at 10:42 pm #13342
    amazing2061
    Member

    The following link provides instructions on how to make a customer input field mandatory:

    Can I require or make mandatory the Collect Customer Input field?

    My question is would not these instructions have a site wide affect on all customer input fields? Is there a way to only target select customer input fields that I need to make mandatory? Thanks.

    March 11, 2016 at 11:50 pm #72728
    admin
    Keymaster

    We can add a CSS class in the button form that has the product ID in there. This will allow you to target “collect input” field of certain products only.

    Let me know if that will help.

    March 12, 2016 at 12:33 am #72729
    amazing2061
    Member

    That would help! Can you please share? Thank you

    March 12, 2016 at 2:55 am #72730
    admin
    Keymaster

    okay, I have added the product specific classes in there. Sent you an update via email.

    Now you can apply a tweak like the following to trigger this code for a particular product ID. In this example code the product ID is 2.

    jQuery(document).ready(function($) {
    $('.eStore-button-form-2).on('submit', function() {
    var $thisbuttonform = $(this);
    var custom_input = $thisbuttonform.find('.eStore_collect_input').val();
    if(!custom_input.trim()){
    alert('Please enter a value in the custom input field');
    return false;
    }
    });
    });

    March 12, 2016 at 1:28 pm #72731
    amazing2061
    Member

    Thank you again for the update. Incredible support…same day, unbelievable!

    Before I install the update, am I to assume the code you posted here is added as follows:

    “Open the “lib/eStore_read_form.js” file and add the block of code at the beginning of that file”

    Also, I will have several instances of a custom input field I will want to make mandatory, how would I modify the code you provided if I have say for example four products with product ID’s of 3, 4, 5, 6? Sorry, not very good with code and how it works, but I’m learning. Thanks again!

    March 13, 2016 at 8:15 pm #72732
    admin
    Keymaster

    You can do the following to apply this to a few of your products (in this example it will do it for product ID 2,3,4,5 and 6:

    jQuery(document).ready(function($) {
    $('.eStore-button-form-2, .eStore-button-form-3, .eStore-button-form-4, .eStore-button-form-5, .eStore-button-form-6').on('submit', function() {
    var $thisbuttonform = $(this);
    var custom_input = $thisbuttonform.find('.eStore_collect_input').val();
    if(!custom_input.trim()){
    alert('Please enter a value in the custom input field');
    return false;
    }
    });
    });

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ