• Resolved Daniel Jimenez

    (@somosgrow)


    Hi guys, hoping you’re doing great.

    I would like to know if there is a way to make that when a user adds a url in a form field, it has to have https in order to validate that field and not only https://www.website.com.

    Thanks in advance for your help.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @somosgrow,

    I hope you are keeping well today and thank you for reaching out to us.

    I regret to inform you that validating secure URLs for the Website URL field is not supported by default. However, I have reached out to our developers to check if potential workarounds or solutions for this could be provided. We will provide an update here as soon as we receive feedback.

    Thank you for your understanding and patience.

    Kind Regards,
    Nebu John

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @somosgrow ,

    Please try this code snippet:

    <?php
    add_action( 'wp_footer', 'wpmudev_website_field_custom_validate', 9999 );
    function wpmudev_website_field_custom_validate() {
    	global $post;
        if ( is_a( $post, 'WP_Post' ) && !has_shortcode( $post->post_content, 'forminator_form' ) ) {
            return;
        }
    	?>
    	<script type="text/javascript">
    	jQuery( document ).ready( function($){
    		setTimeout(function() {
    			$('.forminator-custom-form').trigger('after.load.forminator');
    		},100);
    
    		$(document).on('after.load.forminator', function(event, form_id) {
                if ( event.target.id = 'forminator-module-6' ) {
                    $.validator.addMethod("urlvalid", function (value, element) {
                        if ( value.indexOf("https://") == 0 ) {
                            return true;
                        }
                        return false;
                    },"The URL must contain https.");
                    $( "#url-1 input" ).attr( "urlvalid", "urlvalid" );
                }
    		});
    	});
    	</script>
    	<?php
    }

    In the code here forminator-module-6 need to change 6 to your form ID.

    You can place it as MU plugin https://premium.wpmudev.org/docs/getting-started/download-wpmu-dev-plugins-themes/#installing-mu-plugins

    kind regards,
    Kasia

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @somosgrow

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional questions or problems.

    Best Regards
    Patrick Freitas

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make https:// required on url field’ is closed to new replies.