Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -7,6 +7,7 @@ |
8 | 8 | * @author Jeffrey Stuckman |
9 | 9 | * @author Harold Solbrig |
10 | 10 | * @author Daniel Hansch |
| 11 | + * @author Stephan Gambke |
11 | 12 | * @file |
12 | 13 | * @ingroup SF |
13 | 14 | */ |
— | — | @@ -785,12 +786,23 @@ |
786 | 787 | $field_args['show on select'] = $show_on_select; |
787 | 788 | // Get the value from the request, if |
788 | 789 | // it's there, and if it's not an array. |
| 790 | + $escaped_field_name = str_replace( "'", "\'", $field_name ); |
789 | 791 | if ( isset( $template_instance_query_values ) && |
790 | | - $template_instance_query_values != null && |
791 | | - is_array( $template_instance_query_values ) && |
792 | | - array_key_exists( $field_name, $template_instance_query_values ) ) { |
793 | | - $field_query_val = $template_instance_query_values[$field_name]; |
794 | | - if ( $form_submitted || ( ! is_null( $field_query_val ) && ! is_array( $field_query_val ) ) ) { |
| 792 | + $template_instance_query_values != null && |
| 793 | + is_array( $template_instance_query_values ) ) { |
| 794 | + // If the field name contains an |
| 795 | + // apostrophe, the array sometimes |
| 796 | + // has the apostrophe escaped, and |
| 797 | + // sometimes not. For now, just check |
| 798 | + // for both versions. |
| 799 | + // @TODO - figure this out. |
| 800 | + $field_query_val = null; |
| 801 | + if ( array_key_exists( $escaped_field_name, $template_instance_query_values ) ) { |
| 802 | + $field_query_val = $template_instance_query_values[$escaped_field_name]; |
| 803 | + } elseif ( array_key_exists( $field_name, $template_instance_query_values ) ) { |
| 804 | + $field_query_val = $template_instance_query_values[$field_name]; |
| 805 | + } |
| 806 | + if ( $form_submitted || ( ! empty( $field_query_val ) && ! is_array( $field_query_val ) ) ) { |
795 | 807 | $cur_value = $field_query_val; |
796 | 808 | } |
797 | 809 | } else { |