Set default value for specific fields

Home Forums Quform WordPress Set default value for specific fields

This topic is: not resolved
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #36610
    vsexmogushiy
    Participant

    Hello, once again, thank you very much and bow low. But here’s what I would like to know, how, if, for example, the same UTM tags are not on the page, to send the default value: no. This is the default value, but unfortunately in the form (if there are no values) They don’t come. And I would like to receive just the no value specified by default, please tell me how to do this.

    FROM — https://support.themecatcher.net/forums/topic/google-client-id

    #36615
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #36623
    vsexmogushiy
    Participant

    In option 1, I set “no”,
    In option 2, I set {all_form_data|showEmptyFields:true}.

    However I see empty fields, without default value “no”. How I can fix it?

    Attachments:
    You must be logged in to view attached files.
    #36626
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #36629
    vsexmogushiy
    Participant

    Many Thanks, it works!

    However, please tell me how you can also send the default value (no) for the preceding link ({referring_url}) and for the data after the question mark (val(window.location.search))?

    #36631
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #36712
    vsexmogushiy
    Participant

    Many thanks, but I see only “no” in some cases:

    1. For the screen size:

    jQuery(function ($) {
    $('.quform-field-1_32, .quform-field-2_35, .quform-field-5_36, .quform-field-6_38, .quform-field-7_39, .quform-field-8_40, .quform-field-9_36, .quform-field-10_39, .quform-field-11_39, .quform-field-12_40').val(
    window.screen.width + ' x ' + window.screen.height
    );
    });

    if (!$('.quform-field-1_32, .quform-field-2_35, .quform-field-5_36, .quform-field-6_38, .quform-field-7_39, .quform-field-8_40, .quform-field-9_36, .quform-field-10_39, .quform-field-11_39, .quform-field-12_40').val()) {
    $('.quform-field-1_32, .quform-field-2_35, .quform-field-5_36, .quform-field-6_38, .quform-field-7_39, .quform-field-8_40, .quform-field-9_36, .quform-field-10_39, .quform-field-11_39, .quform-field-12_40').val('no');
    }

    2. For the {referring_url}:


    if (!$('.quform-field-1_33, .quform-field-2_36').val()) {
    $('.quform-field-1_33, .quform-field-2_36').val('no');
    }

    • This reply was modified 7 months, 2 weeks ago by vsexmogushiy.
    #36714
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #36715
    vsexmogushiy
    Participant

    The forms are located on different pages, then what is the principle of dividing them?

    #36716
    vsexmogushiy
    Participant

    Hi please tell me this code are correctly:

    
    //Размеры экрана
    jQuery(function ($) {
        $('.quform-field-1_32').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-2_35').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-5_36').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-6_38').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-7_39').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-8_40').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-9_36').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-10_39').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-11_39').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-12_40').val(
            window.screen.width + ' x ' + window.screen.height
        );
        
    });
    
    //Client ID
    jQuery(function ($) {
    	ym(93307677, 'getClientID', function(clientID) {
    		$('.quform-field-6_39, .quform-field-2_37, .quform-field-5_38, .quform-field-12_44, .quform-field-9_39, .quform-field-1_34, .quform-field-7_42, .quform-field-8_42, .quform-field-10_42, .quform-field-11_42').val(
    			clientID
    		);
    	});
    });
    
    //Yclid Gclid Ga UTM Ссылка  
    jQuery(function ($) {
        function setCookie(name, value, days){
            var date = new Date();
            date.setTime(date.getTime() + (days*24*60*60*1000));
            var expires = "; expires=" + date.toGMTString();
            document.cookie = name + "=" + value + expires + ";path=/";
        }
    
        function readCookie(name) {
            var n = name + "=";
            var cookie = document.cookie.split(';');
            for(var i=0;i < cookie.length;i++) {
                var c = cookie[i];
                while (c.charAt(0)==' '){c = c.substring(1,c.length);}
                if (c.indexOf(n) == 0){return c.substring(n.length,c.length);}
            }
            return 'no';
        }
    
        function getParam(p){
            var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
            return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
        }
    
        var yclid = getParam('yclid');
    
        if (yclid) {
            setCookie('yclid', yclid, 90);
        }
    
        var gclid = getParam('gclid');
    
        if (gclid) {
            setCookie('gclid', gclid, 90);
        }
    
        var utm_source = getParam('utm_source');
    
        if (utm_source) {
            setCookie('utm_source', utm_source, 90);
        }
    
        var utm_medium = getParam('utm_medium');
    
        if (utm_medium) {
            setCookie('utm_medium', utm_medium, 90);
        }
    
        var utm_campaign = getParam('utm_campaign');
    
        if (utm_campaign) {
            setCookie('utm_campaign', utm_campaign, 90);
        }
    
        var utm_content = getParam('utm_content');
    
        if (utm_content) {
            setCookie('utm_content', utm_content, 90);
        }
    
        var utm_term = getParam('utm_term');
    
        if (utm_content) {
            setCookie('utm_term', utm_term, 90);
        }
    
        $('.quform-field-6_43, .quform-field-2_39, .quform-field-5_40, .quform-field-12_46, .quform-field-9_41, .quform-field-1_36, .quform-field-7_44, .quform-field-8_44, .quform-field-10_44, .quform-field-11_44').val(readCookie('yclid'));
        $('.quform-field-6_47, .quform-field-2_40, .quform-field-5_41, .quform-field-12_47, .quform-field-9_42, .quform-field-1_37, .quform-field-7_45, .quform-field-8_45, .quform-field-10_45, .quform-field-11_45').val(readCookie('gclid'));
        $('.quform-field-6_56, .quform-field-2_41, .quform-field-5_42, .quform-field-12_48, .quform-field-9_43, .quform-field-1_38, .quform-field-7_46, .quform-field-8_46, .quform-field-10_46, .quform-field-11_46').val(readCookie('_ga'));
        $('.quform-field-6_51, .quform-field-2_42, .quform-field-5_43, .quform-field-12_49, .quform-field-9_44, .quform-field-1_39, .quform-field-7_47, .quform-field-8_47, .quform-field-10_47, .quform-field-11_47').val(readCookie('utm_source'));
        $('.quform-field-6_52, .quform-field-2_43, .quform-field-5_44, .quform-field-12_50, .quform-field-9_45, .quform-field-1_40, .quform-field-7_48, .quform-field-8_48, .quform-field-10_48, .quform-field-11_48').val(readCookie('utm_medium'));
        $('.quform-field-6_55, .quform-field-2_44, .quform-field-5_45, .quform-field-12_51, .quform-field-9_46, .quform-field-1_41, .quform-field-7_49, .quform-field-8_49, .quform-field-10_49, .quform-field-11_49').val(readCookie('utm_campaign'));
        $('.quform-field-6_54, .quform-field-2_45, .quform-field-5_46, .quform-field-12_52, .quform-field-9_47, .quform-field-1_42, .quform-field-7_50, .quform-field-8_50, .quform-field-10_50, .quform-field-11_50').val(readCookie('utm_content'));
        $('.quform-field-6_53, .quform-field-2_46, .quform-field-5_47, .quform-field-12_53, .quform-field-9_48, .quform-field-1_43, .quform-field-7_51, .quform-field-8_51, .quform-field-10_51, .quform-field-11_51').val(readCookie('utm_term'));
    
    });
    
    //Если пустое значение в размере экрана возвращать no
    if (!$('.quform-field-1_32').val()) {
        $('.quform-field-1_32').val('no');
    }
    
    if (!$('.quform-field-2_35').val()) {
        $('.quform-field-2_35').val('no');
    }
    
    if (!$('.quform-field-5_36').val()) {
        $('.quform-field-5_36').val('no');
    }
    
    if (!$('.quform-field-6_38').val()) {
        $('.quform-field-6_38').val('no');
    }
    
    if (!$('.quform-field-7_39').val()) {
        $('.quform-field-7_39').val('no');
    }
    
    if (!$('.quform-field-8_40').val()) {
        $('.quform-field-8_40').val('no');
    }
    
    if (!$('.quform-field-9_36').val()) {
        $('.quform-field-9_36').val('no');
    }
    
    if (!$('.quform-field-10_39').val()) {
        $('.quform-field-10_39').val('no');
    }
    
    if (!$('.quform-field-11_39').val()) {
        $('.quform-field-11_39').val('no');
    }
    
    if (!$('.quform-field-12_40').val()) {
        $('.quform-field-12_40').val('no');
    }
    
    //Если пустое значение в городе по dadata возвращать no
    if (!$('.quform-field-1_25').val()) {
        $('.quform-field-1_25').val('no');
    }
    
    if (!$('.quform-field-2_20').val()) {
        $('.quform-field-2_20').val('no');
    }
    
    if (!$('.quform-field-5_20').val()) {
        $('.quform-field-5_20').val('no');
    }
    
    if (!$('.quform-field-6_20').val()) {
        $('.quform-field-6_20').val('no');
    }
    
    if (!$('.quform-field-7_20').val()) {
        $('.quform-field-7_20').val('no');
    }
    
    if (!$('.quform-field-8_20').val()) {
        $('.quform-field-8_20').val('no');
    }
    
    if (!$('.quform-field-9_20').val()) {
        $('.quform-field-9_20').val('no');
    }
    
    if (!$('.quform-field-10_20').val()) {
        $('.quform-field-10_20').val('no');
    }
    
    if (!$('.quform-field-11_20').val()) {
        $('.quform-field-11_20').val('no');
    }
    
    if (!$('.quform-field-12_20').val()) {
        $('.quform-field-12_20').val('no');
    }
    
    //Если пустое значение в Предшесвующей ссылке возвращать no
    if (!$('.quform-field-1_30').val()) {
        $('.quform-field-1_30').val('no');
    }
    
    if (!$('.quform-field-2_24').val()) {
        $('.quform-field-2_24').val('no');
    }
    
    if (!$('.quform-field-5_24').val()) {
        $('.quform-field-5_24').val('no');
    }
    
    if (!$('.quform-field-6_36').val()) {
        $('.quform-field-6_36').val('no');
    }
    
    if (!$('.quform-field-7_24').val()) {
        $('.quform-field-7_24').val('no');
    }
    
    if (!$('.quform-field-8_24').val()) {
        $('.quform-field-8_24').val('no');
    }
    
    if (!$('.quform-field-9_24').val()) {
        $('.quform-field-9_24').val('no');
    }
    
    if (!$('.quform-field-10_24').val()) {
        $('.quform-field-10_24').val('no');
    }
    
    if (!$('.quform-field-11_24').val()) {
        $('.quform-field-11_24').val('no');
    }
    
    if (!$('.quform-field-12_24').val()) {
        $('.quform-field-12_24').val('no');
    }
    
    //Если пустое значение в ссылке после знака вопроса возвращать no
    if (window.location.search) {
        $('.quform-field-1_44').val(window.location.search);
    } 
    else {
        $('.quform-field-1_44').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-2_47').val(window.location.search);
    } 
    else {
        $('.quform-field-2_47').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-5_48').val(window.location.search);
    } 
    else {
        $('.quform-field-5_48').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-6_57').val(window.location.search);
    } 
    else {
        $('.quform-field-6_57').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-7_52').val(window.location.search);
    } 
    else {
        $('.quform-field-7_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-8_52').val(window.location.search);
    } 
    else {
        $('.quform-field-8_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-9_49').val(window.location.search);
    } 
    else {
        $('.quform-field-9_49').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-10_52').val(window.location.search);
    } 
    else {
        $('.quform-field-10_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-11_52').val(window.location.search);
    } 
    else {
        $('.quform-field-11_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-12_54').val(window.location.search);
    } 
    else {
        $('.quform-field-12_54').val('no');
    }
    
    • This reply was modified 7 months, 2 weeks ago by vsexmogushiy.
    • This reply was modified 7 months, 2 weeks ago by vsexmogushiy.
    • This reply was modified 7 months, 2 weeks ago by vsexmogushiy.
    • This reply was modified 7 months, 2 weeks ago by vsexmogushiy.
    • This reply was modified 7 months, 2 weeks ago by vsexmogushiy.
    #36722
    vsexmogushiy
    Participant

    I double-checked the code and understand that the check does not work (for the previous link, the Screen size and another field that indicates the sending region) in the construction of such:

     if (!$('.quform-field-11_24').val()) {
        $('.quform-field-11_24').val('no');
    }
     

    I beg you, tell me how to fix it?

    • This reply was modified 7 months, 2 weeks ago by vsexmogushiy.
    #36738
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy