I've asked the developers for their feedback on this one, why it is specifically set up this way. Thanks for your patience, as it's the weekend and outside our normal support hours.
In the meantime, it's possible to change this message with jQuery if you like. There are just a few lines of code.
See this form:
http://gravity.chrishajer.com/change-validation-message-on-user-defined-price-product/
Submit with nothing entered and the form will come back with two validation errors. The first one uses the default validation error message of "This field is required." The second field, the donation field (user-defined price), will come back with an error message of "You gotta give me something here." That is changed with the following code:
Add this to your theme's functions.php
[php]
// change 142 here to your form ID
add_action('gform_enqueue_scripts_142', 'enqueue_validation_message', 10, 2);
function enqueue_validation_message($form, $is_ajax) {
// enqueue the scroll to top script which is stored in the child theme /js/ subdirectory, and depends on jQuery
wp_enqueue_script('validation_message', get_stylesheet_directory_uri() . '/js/validation-message.js', array('jquery'));
}
That code references a script in your theme (or child theme)'s "js" directory called validation-message.js. That file contains this code:
[js]
jQuery(document).ready(function($) {
$('div.gform_wrapper div.gform_body li#field_142_2 div.validation_message').html('You gotta give me something here.');
});
You will need to change the #field_142_2 to the ID of the form field for which you want to have this validation message.
If you have any questions implementing this, please let us know.
Posted 12 years ago on Sunday August 26, 2012 |
Permalink