Widget Form - field value and text

I propose to add to the form widget the ability to separate the value and text for Select, radio, checkbox .

Example php

<?php foreach ( $select_options as $select_option ) { 
$select_option = explode( "|", $select_option);
$select_option[1] = isset($select_option[1]) ? $select_option[1] : $select_option[0];	
?>
<option value="<?php echo esc_attr( strip_tags( $select_option[0] ) ); ?>" <?php selected( isset( $field['value'] ) ? $field['value'] : '', $select_option[1] ); ?>><?php echo strip_tags( $select_option[1] ); ?></option>

see post Brick Builder Form - Select field Value

4 Likes

Yes please, that would be an important feature. Because of this alone, you now have to install a different form extension.

Is the example-php the Solution? Does that work or is there any news to Text | Value in forms?

at the time the solution was provided it worked perfectly.

Sounds like a pretty basic feature indeed! In the meantime, where do you integrate the code in question to make this possible on my own site if it works ?

To check, I made changes here.
/includes/elements/form.php

But it’s better to make this a separate element.

1 Like

is it it no possible to write a function on functions.php? sorry for asking dumb questions :wink: