Skip to content

Commit

Permalink
repeat field: store and show textfield data
Browse files Browse the repository at this point in the history
  • Loading branch information
sapayth committed Dec 3, 2023
1 parent d27d16b commit d5492d9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion assets/css/frontend-forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,6 @@ body ul.wpuf-form .wpuf-field-columns .wpuf-column-field-inner-columns .wpuf-col
border: 0;
float: none;
width: 100%;
overflow: hidden;
}
body ul.wpuf-form .wpuf-field-columns .wpuf-column-field-inner-columns .wpuf-column .wpuf-column-inner-fields {
padding: 0 5px 0 0;
Expand Down
4 changes: 2 additions & 2 deletions assets/js/frontend-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@
clone.find( 'input' ).val( '' );
clone.find( 'textarea' ).val( '' );
clone.find( ':checked' ).prop( 'checked', false );
div.after( clone );

WP_User_Frontend.calculateFieldsName( $( this ).parents( '.wpuf-field-columns' ) );
WP_User_Frontend.setRowNumber( $( this ).closest( '.wpuf-field-columns' ) );

div.after( clone );
},

removeRepeatField: function () {
Expand Down
1 change: 0 additions & 1 deletion assets/less/frontend-forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,6 @@ ul.wpuf-form{
border: 0;
float: none;
width: 100%;
overflow: hidden;

.wpuf-column-inner-fields{
padding: 0 5px 0 0;
Expand Down
7 changes: 6 additions & 1 deletion wpuf-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,12 @@ function wpuf_show_custom_fields( $content ) {
for ( $index = 0; $index < $repeat_rows; $index++ ) {
$field_value = get_post_meta( $post->ID, $repeat_field_name . '_' . $index . '_' . $column_field['name'], true );
$hide_label = ! empty( $column_field['hide_field_label'] ) ? $column_field['hide_field_label'] : 'no';
$html .= '<li>';

if ( is_array( $field_value ) ) {
$field_value = implode( ', ', $field_value );
}

$html .= '<li>';

if ( 'no' === $hide_label ) {
$html .= '<label>' . $column_field['label'] . ': </label>';
Expand Down

0 comments on commit d5492d9

Please sign in to comment.