Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter n2jtx

    (@n2jtx)

    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.

    Thread Starter n2jtx

    (@n2jtx)

    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 );
    Thread Starter n2jtx

    (@n2jtx)

    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.

    Thread Starter n2jtx

    (@n2jtx)

    Actually 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';
    }
    Thread Starter n2jtx

    (@n2jtx)

    Due 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';
    	}
Viewing 5 replies - 1 through 5 (of 5 total)