Black Friday Sale Now on! Learn More
Skip to content

gfic_choice_price

Description

This Javascript filter can be used to override the Image Choices price text on the front-end form display

Usage

Applies to all fields.

gform.addFilter( 'gfic_choice_price', function( priceText, selectedPrice, price, formId, fieldId, index ){
    return priceText;
}, 10, 6);

Applies to all fields in a specific form. In this case, form id 5.

gform.addFilter( 'gfic_choice_price_5', function( text, selectedPrice, price, formId, fieldId, index ){
    return priceText;
}, 10, 6);

Applies to specific field and form. In this case, field id 3 in form id 5.

gform.addFilter( 'gfic_choice_price_5_3', function( text, selectedPrice, price, formId, fieldId, index ){
    return priceText;
}, 10, 6);

Applies to specific choice, field and form. In this case, the first choice (zero-indexed) for field id 3 in form id 5.

gform.addFilter( 'gfic_choice_price_5_3_0', function( text, selectedPrice, price, formId, fieldId, index ){
    return priceText;
}, 10, 6);

Parameters

  • priceText String
    Current price text.
  • selectedPrice Number
    The price of the currently selected option.
  • price Number
    The price of this option. (The option that this label applies to).
  • formId Number
    The current form id.
  • fieldId Number
    The current field id.
  • index Number
    The current option index.

Examples

This example adds some additional HTML to the price text on a specific field:

gform.addFilter( 'gfic_choice_price_5_3', function( text, selectedPrice, price, formId, fieldId, index ){
    return priceText + ' <span class="new-style">SALE PRICE</span>';
}, 10, 6);

Placement

Your code snippet can be placed in a HTML field on your form (within <script></script> tags), or in a theme custom JavaScript file, or you could use the free Gravity Forms Code Chest addon by our friends at GravityWiz.

Source Code

This filter is located in the imageChoices.gform_format_option_label function in js/gf_image_choices.js.