Шорткод в поле Gravity Forms (Shortcode in the Gravity Forms field)

Привет, друзья! Помогите пожалуйста решить проблему.

Можно ли использовать шорткод стороннего плагина в форме какого-либо поля Gravity Forms?

Если этот шорткод принимает значение е-мейла. [ifso id=“7688”] = name@gmail.com

Или, можно ли, где-нибудь использовать код для помещения значения этого шорткода в поле формы Gravity Forms?
Код: <?php echo_shortcode('[ifso id="7688" ajax="yes"]'); ?>

Я знаю, что поле html поддерживает шорткод и правильно его обрабатывает. Жалко, что из html нельзя скопировать значение этого шорткода в другое поле.

Основная цель - чтобы поле приняло значение шорткода в виде емейла, и далее это поле я указываю в пункте BBC настройках формы, для отправки уведомления на этот емейл.

Может кто-нибудь помочь в этом вопросе?

Google Translate version:

Hello friends! Please help me solve the problem.

Is it possible to use a third party plugin shortcode in the form of any Gravity Forms field?

If this shortcode accepts an email value. [ifso id=“7688”] = name@gmail.com

Or is it possible to use some code somewhere to put the value of this shortcode in a Gravity Forms form field?
Code: <?php echo_shortcode('[ifso id="7688" ajax="yes"]'); ?>

I know the html field supports the shortcode and handles it correctly. It’s a pity that you can’t copy the value of this shortcode from html to another field.

The main goal is for the field to take the value of the shortcode in the form of an email, and then I specify this field in the BBC section of the form settings to send a notification to this email.

Can anyone help in this matter?

Andrey, processing shortcodes added as field values is not supported by default. You could try using the gform_save_field_value to call your shortcode using PHP before saving the field value. Example:

add_filter( 'gform_save_field_value_6_8', 'save_shortcode_value', 10, 4 );

function save_shortcode_value( $value, $lead, $field, $form ) {

    return do_shortcode( 'Your shortcode here' );

}

In the above example you will want to replace 6 and 8 with your form id and field id respectively, and Your shortcode here with the shortcode you want to use.

Anyway, bear in mind that shortcodes are usually designed to be added to the WordPress editor, so they may fail if they’re used in other places. If this happens, you may want to ask the author of the shortcode if there’s any function call that you could use instead.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.