Request: Submit using button instead of input?
-
I love this plugin and I’ve been using it for years on many projects. I have one request though:
The submit button is outputted as an input element with “submit” as its type. While this is all well and good for most purposes, input elements cannot have generated content (:before and :after), which limits the styling possibilities. A button element on the other hand can have generated content attached to it. Beyond that, the two elements act the same: they both submit the form and they also look the same without styling.
Unfortunately, there seems to be no way to change the html tag of the submit button without editing the plugin files directly. So, what do you think of the idea of changing the tag to “button” instead of “input”?
The code changes required would be something like this:
function wpcf7_submit_shortcode_handler( $tag ) { $tag = new WPCF7_Shortcode( $tag ); $class = wpcf7_form_controls_class( $tag->type ); $atts = array(); $atts['class'] = $tag->get_class_option( $class ); $atts['id'] = $tag->get_id_option(); $atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true ); $value = isset( $tag->values[0] ) ? $tag->values[0] : ''; if ( empty( $value ) ) $value = __( 'Send', 'contact-form-7' ); $atts['type'] = 'submit'; // Next line commented out // $atts['value'] = $value; $atts = wpcf7_format_atts( $atts ); // Next line is changed $html = sprintf( '<button %1$s>%2$s</button>', $atts, $value ); return $html; }
The topic ‘Request: Submit using button instead of input?’ is closed to new replies.