Home › Forums › WC Vendors Pro Support › Applying Character Limits to Custom Fields in the Product Form › Reply To: Applying Character Limits to Custom Fields in the Product Form
Thanks Jamie, this is working. I do have another couple of questions however:
1) if I have a field that needs a character limit and is required, how do I do that? Is it possible to make data-rules an array like this:
WCVendors_Pro_Form_Helper::input( array( 'type' => 'text', 'post_id' => $object_id, 'id' => 'wcv_custom_product_language_spoken', 'label' => __( 'Language Spoken by Staff', 'wcvendors-pro' ), 'placeholder' => __( 'Language Spoken by Staff', 'wcvendors-pro' ), 'desc_tip' => 'true', 'description' => __( 'Language Spoken by Staff', 'wcvendors-pro' ), 'custom_attributes' => array( 'multiple' => 'multiple', 'data-rules' => array ( 'max_length', 'required')) ) );
I’m testing this now, and it doesn’t seem to be working. It’s not throwing the error for the required field. Let me know how I’d do this, and how I’d specify the errors for both cases.
In a more general sense, is there documentation anywhere on how to set all the options of the input arrays for these fields? I can’t find any reference on this site beyond the single case example in the “Adding a Custom Field for Products” KnowledgeBase article; I’ve spent a couple hours getting familiar with WP form inputs in general, but it looks like WC Vendors & Pro overlay that functionality and have a language of their own. A reference, if it exists would be great to have access to, and if it doesn’t would be a fabulous thing to create and share.