Title: Validation Logic
Last modified: February 22, 2020

---

# Validation Logic

 *  Resolved [martiuseduardo](https://wordpress.org/support/users/martiuseduardo/)
 * (@martiuseduardo)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/validation-logic-3/)
 * Hi, I want to create a validation rule, but I don’t know how to create it dynamically.
   
   Example: data-parsley-max=”dynamic value” I created a Non Option Variable and
   can I use that variable in my validation?
 * How can I do that?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fvalidation-logic-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [moomooagency](https://wordpress.org/support/users/moomooagency/)
 * (@moomooagency)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/validation-logic-3/#post-12471977)
 * Hi,
 * Please, check this blog post: [https://moomoo.agency/create-product-like-on-blinds4udirect-co-uk-in-woocommerce-with-uni-cpo/](https://moomoo.agency/create-product-like-on-blinds4udirect-co-uk-in-woocommerce-with-uni-cpo/)
   It has examples of doing similar things.
 *  Thread Starter [martiuseduardo](https://wordpress.org/support/users/martiuseduardo/)
 * (@martiuseduardo)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/validation-logic-3/#post-12571560)
 * Hi, it didn’t help.
 * I have 2 text input.
    input 1: size of the cut input 2: quantity of the cut
 * If the client wants buy 1 meter (or 100cm), he can cut like that:
    Minimum: 10
   cm (=10 pieces of). In the input 2 I need to limit the max of pieces on 10. May
   have left over.
 * If he wants to cut on 25cm (size), then the max limit is 4 pieces (quantity) 
   of the material.
    If he wants to cut on 33cm (size), then the max limit is 3 
   pieces (quantity).
 * Did you understand? The max limit of the input 2 is dynamic.
 *  Plugin Author [moomooagency](https://wordpress.org/support/users/moomooagency/)
 * (@moomooagency)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/validation-logic-3/#post-12572782)
 * Of course I did. So do you use conditional validation logic. The blog post I 
   showed you has an example of setting min/max values dynamically for width/height
   based on the value of the unit. Fits perfectly for you case. Please, study it
   thoroughly.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Validation Logic’ is closed to new replies.

 * ![](https://ps.w.org/uni-woo-custom-product-options/assets/icon-256x256.jpg?rev
   =1764217)
 * [Product Options and Price Calculation Formulas for WooCommerce – Uni CPO](https://wordpress.org/plugins/uni-woo-custom-product-options/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/uni-woo-custom-product-options/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/uni-woo-custom-product-options/)
 * [Active Topics](https://wordpress.org/support/plugin/uni-woo-custom-product-options/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/uni-woo-custom-product-options/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/uni-woo-custom-product-options/reviews/)

## Tags

 * [logic](https://wordpress.org/support/topic-tag/logic/)
 * [parsley](https://wordpress.org/support/topic-tag/parsley/)
 * [uniCpo](https://wordpress.org/support/topic-tag/unicpo/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * 3 replies
 * 2 participants
 * Last reply from: [moomooagency](https://wordpress.org/support/users/moomooagency/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/validation-logic-3/#post-12572782)
 * Status: resolved