Description
This JavaScript hook allows help text to be displayed below the choices in the Form Editor.
Note: This hook in used in the Gravity Forms Quiz and Survey add-ons.
Usage
gform.addAction( 'gform_load_field_choices', function ( field ) {
// do something
} );
Parameters
- field Field Object
The current field.
Examples
This example uses the gform_editor_js action to load the hook.
add_action( 'gform_editor_js', 'add_script_to_editor' );
function add_script_to_editor() {
?>
<script type='text/javascript'>
gform.addAction('gform_load_field_choices', function( ){
field = GetSelectedField();
//write text to the field's description
formId = field.formId;
fieldId = field.id;
jQuery('#gfield_description_' + formId + '_' + fieldId).html('This is a test');
});
</script>
<?php
}
Placement
Reference the article Adding JavaScript Code to the Admin Side of Your Site.
Since
This filter was added in Gravity Forms version 1.7.
Source Code
This filter is located in LoadFieldChoices() in js/form_editor.js.