n2jtx
Forum Replies Created
-
In version 2.0.1, go into “edit” for this plugin and search for the first line in the code snippet above (the one with ‘aria-invalid’). Underneath it you will see the “$value =” assignment. Highlight that line and paste in the code from above between the “//PATCH” and “//END PATCH” comments to replace it. Save it and you should be good to go.
It seems a hack for this was quite simple. With this change I can now specify [dynamictext variable-name placeholder “Default Value” “Placeholder Value”]. If “Placeholder Value” is not specified, then “Default Value” is used for the placeholder text instead:
$atts['aria-invalid'] = $validation_error ? 'true' : 'false'; //PATCH: Allow user specific placeholder text as the last value. // First value will be used if it is blank. $value = (string) reset( $tag->values ); $value2 = (string) next( $tag->values ); if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) { $atts['placeholder'] = ( '' !== $value2 ? $value2 : $value ); $value = ''; $value2 = ''; } $value = (string) reset( $tag->values ); //END PATCH $value = $tag->get_default_option( $value );There are two ways a user can bring up the form. Either entering the URL manually, in which case “regid” is undefined and they need to type it in, or through a link in my firms application in which case the variable is supplied by the software to the URL. I am looking for the placeholder when “regid” is blank. It appears I might be able to hack this as $tag->values is an array and I would need logic to determine if there is more than one value and if “placeholder” is present.
Forum: Plugins
In reply to: [Contact Form 7 - Dynamic Text Extension] Created a Conditional Edit BoxActually my previous code did not work completely because $value was not yet defined. A simple change as follows got it working again:
$atts['value'] = $value; //PATCH: Create the "editifblank" option. Must be checked AFTER // $value is defined. if ( $tag->has_option( 'editifblank' ) && ( '' !== $value ) ) { $atts['readonly'] = 'readonly'; }Forum: Plugins
In reply to: [Contact Form 7 - Dynamic Text Extension] Created a Conditional Edit BoxDue to the 2.0 plugin changes, I had to modify the code as follows:
if ( $tag->has_option( 'readonly' ) ) { $atts['readonly'] = 'readonly'; } elseif ( $tag->has_option( 'editifblank' ) && ( '' !== $value ) ) { $atts['readonly'] = 'readonly'; }