Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter rian1995

    (@rian1995)

    Excuse me @codekraft
    I need your advice.
    I guess it is not the perfect solution but it can work:

    add_filter( ‘wpcf7_validate_tel*’, ‘custom_tel_confirmation_validation_filter’, 20, 2 );

    function custom_tel_confirmation_validation_filter( $result, $tag ) {
    if ( ‘tel-155’ == $tag->name ) {
    $your_tel = isset( $_POST[‘tel-155’] ) ? trim( $_POST[‘tel-155′] ) : ”;
    if(strpos(substr( $your_email , 1 , $your_tel.length),’+’) !== false){
    $result->invalidate( $tag, “Please Set as Correct Phone Number” );
    }else{
    if ( substr( $your_email , 0 , 1) != ‘0’ || substr( $your_email , 0 , 1) != ‘+’ ) {
    $result->invalidate( $tag, “Please Set as Correct Phone Number” );
    }
    }

    }
    return $result;
    }

    I will mark as resolved if this is okay to work.
    BTW, I did not learn PHP before, So I have to double check, in case it crush.

    Thread Starter rian1995

    (@rian1995)

    Excuse me @codekraft
    I need your advice.
    I guess it is not the perfect solution but it can work:

    add_filter( 'wpcf7_validate_tel*', 'custom_tel_confirmation_validation_filter', 20, 1 );
      
    function custom_tel_confirmation_validation_filter( $result, $tag ) {
      if ( 'tel-155' == $tag->name ) {
        $your_tel = isset( $_POST['tel-155'] ) ? trim( $_POST['tel-155'] ) : '';
    	  if(strpos(substr( $your_email , 1 , $your_tel.length),'+') !== false){ 
    		$result->invalidate( $tag, "Please Set as Correct Phone Number" );
    	  }else{
    		  if ( substr( $your_email , 0 , 1) != '0' || substr( $your_email , 0 , 1) != '+' ) {
    		  $result->invalidate( $tag, "Please Set as Correct Phone Number" );
    		}
    	  }
        
      }  
      return $result;
    }

    I will mark as resolved if this is okay to work.
    BTW, I did not learn PHP before, So I have to double check, in case it crush.

    • This reply was modified 5 years ago by rian1995.
    Forum: Plugins
    In reply to: [Contact Form 7] inbox
    rian1995

    (@rian1995)

    hi @adityakoploh
    I guess your contact form just like
    [text* your-name ]
    [email* your-email]
    [text your-subject]
    [text your-message]

    in the setting of “email”
    there is an option might be “use as HTML5 format”
    Bewteen the mail contain(inbox) and the file(include file).
    Make sure that option stay disable

    Thread Starter rian1995

    (@rian1995)

    Hi @codekraft
    I`ll try. Where I should put this filter in my fucntion.js? Or inside the other setting in my form?

    Forum: Plugins
    In reply to: [Contact Form 7] inbox
    rian1995

    (@rian1995)

    Could you provide the website?
    I guess it about how to set the form.
    like: you need email
    it should be [email your-email] (O)
    instead of [your-email] (X)

    rian1995

    (@rian1995)

    Hi there,
    Mine website using the “prop(“disabled”,false)” cause the form not able to be submit data, it just stop right there and do nothing. even if i add a setTimeOut to prevent this issue.
    And I solve this issue by add a fake button switch showing in between the real one.
    And I and my own control logic

    <script language="javascript">
    	var realBtn=document.getElementsByClassName('wpcf7-submit').item(0),
    		fT=0,
    		flagF=false,
    		fS="";
    document.getElementById('qt').style.display="";
    document.getElementById('fakeBtn').style.display="none";
    realBtn.setAttribute("onclick","subchecking();");
    function subchecking(){document.getElementById('qt').style.display="none";
    					   document.getElementById('fakeBtn').style.display="";
    					   if(fT<5 && !flagF){window.setTimeout(cS,500);}}
    function cS(){fS = document.getElementsByClassName('wpcf7-form').item(0).dataset.status;
    			  if(fS == 'sent' || fS == 'resetting'){
    				  document.getElementsByClassName('mainform').item(0).classList.add('hidden');
    document.getElementsByClassName('sentform').item(0).classList.remove('hidden');
    alert('Great success');
    				  flagF=true;
    			  }else if(fS == 'submitting'){
    				  window.setInterval(rcs,100);
    			  }else if( fS == 'invalid' || fS== 'init'){
    				  if(fS=='invalid'){
    					  fT++;
    					  document.getElementById('fakeBtn').style.display="none";
    					  document.getElementById('qt').style.display="";
    			  }else{
    				  document.getElementById('fakeBtn').style.display="none";
    				  document.getElementById('qt').style.display="";}
    			  }else{
    				  alert('Try later');
    				  document.getElementById('fakeBtn').getElementsByTagName('p').item(0).innerHTML="You sent too many times"}}
    function rcs(){
    	fS = document.getElementsByClassName('wpcf7-form').item(0).dataset.status;
    	if(fS==""){fS = document.getElementsByClassName('wpcf7-form').item(0).dataset.status
    			  }else if(fS=='submitting'){fS=""}else{clearInterval(rcs);cS();}}
    </script>

    First step: Make your own fake button in first and give it id=”fakeBtn”.
    Second: check there only one submit button and only only one CF7 form.
    The javascript doing the reset:
    1.Add the onclick property to the real submit button.
    2.Set fake Button disapear (you should do this in advance in case u forget)
    3.If the user click the “real submit” trigger event=>
    hide real button and show the fake button
    =>wait 500ms and check the submit status is submittng? invalid data? or just sent success?
    if it is subbmiting or checking =>wait every 100ms to check again
    (I feel this speed is cool not overly wait or short)=> status changed stop “rechecking”
    if it is invalid give the real button to user and hide the other one.
    if it is success alert “great success” (you can change it into active something else)
    if click the real button over 5 times (change at “if(fT<5 && !flagF)”)
    Only show the fake button and change the fake button html text as”You sent too many times”

    Plugin Author is right. Make sure your form is total correct in setting. Then think about hiding button things

    Thread Starter rian1995

    (@rian1995)

    I found out that the “+” is organically supported. And is already been defined the “+” can be only put at the very first.
    So I guess I only need the rule of “if it`s not start as ‘+’ than it have to be start as’0′” .
    And If possible I want to add a ban list for phone number.

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