Home Forums WC Vendors Pro Support Custom Fields in Product Form – Multiple Data Error Handlers

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #39065
    Daniel
    Participant

    Hello, we’ve got a situation where we need to be able to use two different data-error handlers for the same WC Vendors Custom Product Field – one for not filling in the required field, the other for going over 120 characters. How do we do it?

    Here’s what we currently have, and the error handlers are not working as intended – it seems when one or the other rule is broken, the whole message ‘Maximum 120 Characters|This field is required.’ gets returned.

    // Language Spoken Field
    	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' => 'max_length[120]|required',
    			'data-error' => __( 'Maximum 120 Characters|This field is required.', 'wcvendors-pro' ))					  
    	) );

    Any help is appreciated

    #39087
    Jamie
    Keymaster

    Hello,

    The data error can only be one thing. Unfortunately it is a limitation of our validation library that we can’t have multiple requires and multiple returned messages. My suggestion would be to change the error message to say something like, “This field is required and limited to 120 characters.”

    cheers

    Jamie.

    #39150
    Daniel
    Participant

    Ok, that’ll have to do. Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.