mlarge
Forum Replies Created
-
Forum: Plugins
In reply to: [Calculated Fields Form] Div with two columnsI was able to get it working by removing the div and adding the class “column2” to the first field and class “column3” to the second field and they now align next to each other. But, the div with two columns still doesn’t apply a two column grid for two fields.
Forum: Plugins
In reply to: [Calculated Fields Form] Purchase Order FormSorry, I meant create a PDF form that can be emailed?
That worked!!! Thank you so much for all your help!!! ??
ok, thanks for your help anyway.
Hello,
Still no luck. Not sure what the issue is.
Thanks
Still doesn’t do anything but thanks for your help.
I did exactly as above and there are no results on this page. Are the results supposed to be in a field?
I added the script tag and no results are shown. Is it supposed to show in a field? That is the confusing part of your instructions. I have this code in the product page.
[CP_CALCULATED_FIELDS_RESULT]
<script>
setFieldValue(‘fieldname2_1’, ‘<%fieldname2_value%>’ );
setFieldValue(‘fieldname3_1’, ‘<%fieldname3_value%>’ );
</script>
[/CP_CALCULATED_FIELDS_RESULT][CP_CALCULATED_FIELDS id=”21″]
<script>
function setFieldValue(field, value) {
$(‘[id=”‘ + field + ‘”]’).each(
function () {
var e = $(this),
attr = e.attr(‘vt’),
t = this.tagName;
if (typeof attr == ‘undefined’ && t != ‘SELECT’) {
e.val(value);
if (e.hasClass(‘phone’)) {
value = $.trim(value)
.replace(/[^\d]/g, ‘ ‘)
.split(‘ ‘);
for (var j = 0, h = value.length; j < h; j++) {
$(‘[id=”‘ + field + ‘_’ + j + ‘”]’).val(value[j]);
}
} else if (e.hasClass(‘date’)) {
value = $.trim(value).split(‘ ‘);
$(‘[id=”‘ + field + ‘_date”]’).val(value[0]);
if (value.length > 1) {
var time = value[1].split(‘:’);
$(‘[id=”‘ + field + ‘_hours”]’).val(time[0]);
$(‘[id=”‘ + field + ‘_minutes”]’).val(time[1]);
}
}
} else {
if (t == ‘SELECT’) {
e.find(‘[vt=”‘ + value + ‘”]’)
.prop(‘selected’, true);
} else {
if ((typeof value == ‘object’ &&
$.inArray(attr, value) != ‘-1’) ||
attr == value) {
e.prop(‘checked’, true);
}
}
}
}).change();
};
</script>I followed the instructions on the link below exactly as it states and the result fields display like the above. “setFieldValue(‘fieldname3_1′, ‘2‘ );”
It doesn’t say anything about adding <script> tags and how to get the results in a field.https://blog.net-factor.com/how-to-use-the-data-submitted-by-a-form-in-another-one/
Yes, that worked perfectly. Thanks so much for your help. I have the calculated field results on the redirect pages but it displays in text view. Is there a way to get the results to display in a field? The result for the fieldname 2 is “2” and displays like the below. Can I get that result in a field?
setFieldValue(‘fieldname3_1′, ‘2‘ );
sure, this is the link
I am using the developer version of the plugin. So sorry but this is all new to me so I’m trying to understand the process. I removed the code from the calculator and it now submits to a “Thank you” page. I inserted the javascript code below into the Thank you page but it does not work. It just stays on the Thank you page and doesn’t redirect to the specific URL’s according to the user input of the two fields. Also, would the value code now show in the URL’s below if i place new result fields in the pages?
[CP_CALCULATED_FIELDS_RESULT]
<script>
(function(){
var a = <%fieldname2_value%>;
var b = <%fieldname3_value%>;if(a <= 4 && b == 1) document.location.href = ‘/product-1/’;
if(a >= 5 && a <= 9 && b == 1) document.location.href = ‘/product2.html’;
if(a >= 10 && a <= 15 && b == 1) document.location.href = ‘/product3.html’;
if(a >= 16 && a <= 30 && b == 1) document.location.href = ‘/product4.html’;if(a <= 4 && b == 0) document.location.href = ‘/product5.html’;
if(a >= 5 && a <= 9 && b == 0) document.location.href = ‘/product6.html’;
if(a >= 10 && a <= 15 && b == 0) document.location.href = ‘/product7.html’;
if(a >= 16 && a <= 30 && b == 0) document.location.href = ‘/product8.html’;if(a >= 31 && b >= 0) document.location.href = ‘/rep-form/’;
if(a <= 4 && b >= 2) document.location.href = ‘/rep-form/’;
if(a >= 5 && a <= 9 && b >= 2) document.location.href = ‘/rep-form/’;
if(a >= 10 && a <= 15 && b >= 2) document.location.href = ‘rep-form/’;
if(a >= 16 && a <= 30 && b >= 2) document.location.href = ‘/rep-form/’;})();
</script>
[/CP_CALCULATED_FIELDS_RESULT]What if I put this code in the onclick event of the calculate button?
jQuery(this).closest(‘form’).submit();My form does not use the “Submit” button. My form uses a calculate button labeled. I have the calculated field telling the button to redirect to one of 8 URL’s depending on user input for two number fields. So, I can’t really follow the instructions above if I’m not using the “Submit” button. I tried to use the shortcode above within the redirect pages and it doesn’t work. Is there another solution for my calculation?
So, the following redirects do not take you to a Thank you page at all. It takes you to one of the redirect pages. So, can i import the code you stated above into one of the redirect pages or would there be a special code to insert into the two fields in the redirect page?