Skip to content

Commit 4b9ee15

Browse files
authored
Default form labels not bound to inputs
The default form labels are not working as intended, because a label can be bound to an element either by using the "for" attribute and using the same attribute in the input element "id" or by placing the element inside the <label> element.
1 parent e29268d commit 4b9ee15

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

classes/class-cpt-wplf-form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ function default_content_cpt( $content ) {
161161
// default content starts here:
162162
?>
163163
<label for="name"><?php _e( 'Please enter your name', 'wp-libre-form' ); ?></label>
164-
<input type="text" name="name" placeholder="<?php _ex( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>">
164+
<input type="text" name="name" id="name" placeholder="<?php _ex( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>">
165165

166166
<label for="email"><?php _e( 'Please enter your email address', 'wp-libre-form' ); ?> <?php _e( '(required)', 'wp-libre-form' ); ?></label>
167-
<input type="email" name="email" placeholder="<?php _ex( 'example@email.com', 'Default placeholder email', 'wp-libre-form' ); ?>" required>
167+
<input type="email" name="email" id="email" placeholder="<?php _ex( 'example@email.com', 'Default placeholder email', 'wp-libre-form' ); ?>" required>
168168

169169
<label for="message"><?php _e( 'Write your message below', 'wp-libre-form' ); ?> <?php _e( '(required)', 'wp-libre-form' ); ?></label>
170-
<textarea name="message" rows="5" placeholder="<?php _ex( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea>
170+
<textarea name="message" rows="5" id="message" placeholder="<?php _ex( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea>
171171

172172
<button type="submit"><?php _e( 'Submit', 'wp-libre-form' ); ?></button>
173173

0 commit comments

Comments
 (0)