Title: How to validate input fields?
Last modified: June 8, 2018

---

# How to validate input fields?

 *  Resolved [Jan](https://wordpress.org/support/users/jan3/)
 * (@jan3)
 * [8 years ago](https://wordpress.org/support/topic/how-to-validate-input-fields/)
 * Hi,
 * I would like to make (at least) some client-site validation of whether a name
   field consists of letters and a phone field consists of digits. Any idea how 
   to do that with the shortcodes that are produces by the plugins booking form?
 * Thanks Jan

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [wpdevelop](https://wordpress.org/support/users/wpdevelop/)
 * (@wpdevelop)
 * [8 years ago](https://wordpress.org/support/topic/how-to-validate-input-fields/#post-10377966)
 * Hello.
    Currently Booking Calendar support onky validation for the “email field”
   and for required fields”. Other form fields validations require customization,
   and does not support in actual versions of Booking Calendar. Sorry.
 * For example, if you need to check that visitor enter only digits for phone number,
   you can make customization for additional checking about it.
 * Please open this file ../{Booking Calendar Folder}/js/client.js
 * ( you can check how to edit files in WordPress menu in this article [http://wpbookingcalendar.com/faq/how-edit-file-in-wp-menu/](http://wpbookingcalendar.com/faq/how-edit-file-in-wp-menu/))
 * then find this code:
 *     ```
                   /*if ( element.name == ('phone'+bk_type) ) {
                       // we validate a phone number of 10 digits with no comma, no spaces, no punctuation and there will be no + sign in front the number - See more at: http://www.w3resource.com/javascript/form/phone-no-validation.php#sthash.U9FHwcdW.dpuf
                       var reg =  /^\d{10}$/;
                       var message_verif_phone = "Please enter correctly phone number";
                       if ( inp_value != '' )
                           if(reg.test(inp_value) == false) {showErrorMessage( element , message_verif_phone);return;}
                   }*/
       ```
   
 * and replace it to this code:
 *     ```
                   if ( element.name == ('phone'+bk_type) ) {
                       // we validate a phone number of 10 digits with no comma, no spaces, no punctuation and there will be no + sign in front the number - See more at: http://www.w3resource.com/javascript/form/phone-no-validation.php#sthash.U9FHwcdW.dpuf
                       var reg =  /^\d{10}$/;
                       var message_verif_phone = "Please enter correctly phone number";
                       if ( inp_value != '' )
                           if(reg.test(inp_value) == false) {showErrorMessage( element , message_verif_phone);return;}
                   }
       ```
   
 * Please do not forget to clear browser cache before testing these changes.
 * Disclaimer. Unfortunately we can not start, right now, some personal customization
   or custom development, because almost have no free time.
    Check more about new
   features here [https://wpbookingcalendar.com/faq/need-new-feature/](https://wpbookingcalendar.com/faq/need-new-feature/)
   Thank you for understanding. Please note, if you will modify the source code 
   of the Booking Calendar, we will not guaranteed the correct work of plugin and
   do not support it. Kind Regards.
 *  Thread Starter [Jan](https://wordpress.org/support/users/jan3/)
 * (@jan3)
 * [8 years ago](https://wordpress.org/support/topic/how-to-validate-input-fields/#post-10378363)
 * Thanks for your quick, valuable response.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to validate input fields?’ is closed to new replies.

 * ![](https://ps.w.org/booking/assets/icon-256x256.gif?rev=3335907)
 * [Booking Calendar](https://wordpress.org/plugins/booking/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/booking/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/booking/)
 * [Active Topics](https://wordpress.org/support/plugin/booking/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/booking/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/booking/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jan](https://wordpress.org/support/users/jan3/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/how-to-validate-input-fields/#post-10378363)
 * Status: resolved