Checkbox fields at student registration
-
Hello,
I want to add checkbox field in Student Registration page, for Terms & Conditions..and it should also be Validation..i have done but validation part is not working, see below code..
Below i have added code in student registration page
<div class="tutor-form-row" style="padding-top:20px;"> <div class="tutor-form-col-12"> <div class="tutor-form-group"> <label> <?php _e('Terms & Conditions', 'tutor'); ?> </label> <input type="checkbox" name="terms_n_policy" <?php if(isset($_POST['terms_n_policy'])) echo 'checked="checked"'; ?>> I agree to YogiImpressions Life Academy's <a href="terms-conditions/" target="_blank">Terms of Use</a> & <a href="/privacy-policy/" target="_blank">Privacy Policy</a>. </div> </div> </div>
And below code i have added in functions.php page
add_action( 'user_register', 'bt_add_checkout_checkbox_warning' ); /** * Alert if checkbox not checked */ function bt_add_checkout_checkbox_warning() { if ( ! (int) isset( $_POST['terms_n_policy'] ) ) { wc_add_notice( __( 'Please acknowledge the Checkbox' ), 'error' ); } }
but above code is not working for checkbox validation….
regards
Prakash
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Checkbox fields at student registration’ is closed to new replies.