Went ahead and improved the triggers while handling your GJ About question. The below in CB Auto Actions will let you add new validation.
Global
Triggers: gj_onBeforeCreateGroup, gj_onBeforeUpdateGroup
Type: Code
User: Self
Access: Everybody
Action
Method: PHP
Code:
Code:
if ( cbutf8_strlen( $variables['var1']->getString( 'description', '' ) ) < 50 ) {
$variables['var1']->setError( 'Please provide a description' );
return false;
}
return true;
Output
Display: return
The above will output "Please provide a description" validation error if they try to save without a description. To add client side validation you can use the below.
Global
Triggers: gj_onBeforeDisplayGroupEdit
Type: Code
User: Self
Access: Everybody
Action
Method: jQuery
Code:
Code:
$( '.gjGroupEditForm #description' ).attr( 'minlength', 50 ).addClass( 'required' );
That will add a minimum length requirement of 50 and mark the field as required.