Home › Forums › Quform WordPress › Set default value for specific fields › Reply To: Set default value for specific fields
May 12, 2024 at 12:21 pm #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 4 months, 4 weeks ago by vsexmogushiy.
- This reply was modified 4 months, 4 weeks ago by vsexmogushiy.
- This reply was modified 4 months, 4 weeks ago by vsexmogushiy.
- This reply was modified 4 months, 4 weeks ago by vsexmogushiy.
- This reply was modified 4 months, 4 weeks ago by vsexmogushiy.