Custom Fields
Re-Envisioned
Support General disable user from submitting mobile and email in text area using frontend form

This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 8 months ago.

  • Creator
    Topic
  • #13781

    Hi There i am looking for a solution if some body type mobile number or email address to submit form
    so that the form must not submit how to disable user if he type mobile or email in text area. before form submit using frontend form submit plugin

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #13793

    Anh Tran
    Keymaster

    Hi,

    I think this can be done with custom JavaScript only. So you need to enqueue your JS file on the page that has the form, then in the code, when the form is being submitted, check if the value of the textarea is a mobile number or email address. If it is, then return false to prevent the submission.

    This is a pseudo-code that might give you some idea:

    jQuery( function( $ ) {
        $( '.your-form' ).on( 'submit', function() {
            var value = $( '#your-field' ).val();
            if ( checkIfIsMobileNumberOrEmail( value ) ) {
                return false;
            }
        } );
    } );
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.