@tim, I could change the message via php event '
alter_system_fields_info', but I could not change the "Name: " before the message.
- Code: Select all
$FUNCS->add_event_listener( 'alter_system_fields_info', array('CustomEvents', 'test') );
class CustomEvents{
function test( &$arr_sys_fields, &$his){
//error_log( print_r( $arr_sys_fields['1']->validator_msg , true));
$arr_sys_fields['1']->validator_msg = 'title_ready=Only Lowercase characters, numerals, hyphen and underscore permitted|required=Title is required';
//error_log( print_r( $arr_sys_fields['1']->validator_msg , true));
}
}
- 2017-09-02-195227.png (4.62 KiB) Viewed 28828 times
Also, your sample wouldn't work since there is no such validator like 'name', above message pops out after validator 'required', but even changing it to following doesn't work. That's why I had to resort to event fiddling.
<cms:field 'k_page_name' validator_msg='required=Title field cannot be left empty.' />
I think even if we reconstruct the input by using 'cms:field' as a tag-pair, there is no way that I am aware of to change k_error prefix..
So here is a big question: in last two messages below how to change the auto-prefix 'Name: '?
k_error_k_page_name: Title is required
k_error: Name: Title is required
k_persist_error: Name: Title is required
Answer: A parameter
label in cms:input is used to determine what to show in error message.
So, if it'd be a
<cms:input type='text' name='k_page_name' label='Something Else' required='1'/>
Then error messages would be
k_error: Something Else: Required field cannot be left empty
k_persist_error: Something Else: Required field cannot be left empty