Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Thread Starter eberkland

    (@eberkland)

    I’m using a Calculated Field (set to “Do not evaluate dynamically”) to store JSON into a CFF field using getField('fieldnameXYZ').setVal(...). Is this the best approach for persisting structured data (like toggle states) across views?
    I’ve tried Hidden Fields, but getField(...).jQueryRef() fails to return valid input references for them. Is Calculated Field the most compatible storage type?

    Thread Starter eberkland

    (@eberkland)

    Follow-up question on this topic.

    On my closet builder calculator, users can select the number of drawers they want in a number field (fieldname123)

    Then they can select the number of knobs they want in a checkbox field (with quantity options ticked).

    They can select less than the number of chosen drawers, but not more.

    Is there a way to set quantities assigned to the checkbox as the max-value. So users would not be able to select more than the quantity in fieldname123.

    getField(fieldname455|n).setChoices({texts:[‘Drawer Knobs’], values:[fieldname331], quantities:[fieldname123]});

    Thread Starter eberkland

    (@eberkland)

    You’re the best! This completely solved several workarounds I was doing. Thanks.

    Thread Starter eberkland

    (@eberkland)

    Thanks, user error on that one, I see quantity boxes now.

    I am assigning texts and values to checkbox fields (see example below), is there a way to assign an initial value for the checkbox quantity from another field?

    getField(fieldname455|n).setChoices({texts:[‘Accent Shelf’], values:[fieldname331]});

    Thread Starter eberkland

    (@eberkland)

    Sorry, I can’t give you the link in a public forum because the site contains proprietary pricing information. However, I figured out this solution, which works, but there is probably a more efficient way to do this. Here is the code for anyone who is interested:

    (function() {
    // Retrieve the array of selected values from the checkbox field
    var selectedValues = fieldname359|r; // Use |r to retrieve the raw value (array of selections)

    var summary = '<table>' +
    '<thead><tr>' +
    '<th>Component</th>' +
    '<th>Price</th>' +
    '</tr></thead>' +
    '<tbody>';

    // Check if there are any selected values
    if (selectedValues.length > 0) {
    // Loop through each selected value and construct table rows
    for (var i = 0; i < selectedValues.length; i++) {
    if (selectedValues[i] == 1) {
    summary += '<tr>' +
    '<td>Backing</td>' +
    '<td>' + fieldname381|v + '</td>' +
    '</tr>';
    }
    if (selectedValues[i] == 2) {
    summary += '<tr>' +
    '<td>Accent</td>' +
    '<td>' + fieldname432|v + '</td>' +
    '</tr>';
    }
    // Add more conditions as needed for other checkbox values
    }
    } else {
    // No values selected
    summary += '<tr><td colspan="2">No components selected</td></tr>';
    }

    summary += '</tbody></table>';

    // Update the target element with the generated summary
    jQuery('.summary-here-also').html(summary);
    return summary;
    })();
    Thread Starter eberkland

    (@eberkland)

    If anyone else is looking for a similar solution this worked for me

    (function () {
    // Initialize arrays for labels and values
    let texts = [];
    let values = [];

    // Check and add each label and value conditionally
    if (fieldname444 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">Backing</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname381|v, '</span><span class="pchoice-listmfg">', fieldname443|v, '</span><span class="pchoice-promo">', fieldname444|v, '</span></span>'));
    values.push(fieldname444);
    }
    if (fieldname446 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">Accent</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname432|v, '</span><span class="pchoice-listmfg">', fieldname445|v, '</span><span class="pchoice-promo">', fieldname446|v, '</span></span>'));
    values.push(fieldname446);
    }
    if (fieldname749 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">Baskets</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname747|v, '</span><span class="pchoice-listmfg">', fieldname748|v, '</span><span class="pchoice-promo">', fieldname749|v, '</span></span>'));
    values.push(fieldname749);
    }
    if (fieldname473 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">ACC Rack/Valet</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname468|v, '</span><span class="pchoice-listmfg">', fieldname472|v, '</span><span class="pchoice-promo">', fieldname473|v, '</span></span>'));
    values.push(fieldname473);
    }
    if (fieldname497 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">ACC Counter/Desk</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname492|v, '</span><span class="pchoice-listmfg">', fieldname496|v, '</span><span class="pchoice-promo">', fieldname497|v, '</span></span>'));
    values.push(fieldname497);
    }
    if (fieldname518 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">Shelf Divider</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname516|v, '</span><span class="pchoice-listmfg">', fieldname517|v, '</span><span class="pchoice-promo">', fieldname518|v, '</span></span>'));
    values.push(fieldname518);
    }
    if (fieldname575 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">Design Wall Acc</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname573|v, '</span><span class="pchoice-listmfg">', fieldname574|v, '</span><span class="pchoice-promo">', fieldname575|v, '</span></span>'));
    values.push(fieldname575);
    }
    if (fieldname544 > 0) {
    texts.push(CONCATENATE('<span class="pchoice-label">Design Wall</span><span class="pchoice-value-contain"><span class="pchoice-listmfg">', fieldname542|v, '</span><span class="pchoice-listmfg">', fieldname543|v, '</span><span class="pchoice-promo">', fieldname544|v, '</span></span>'));
    values.push(fieldname544);
    }

    // Assign filtered labels and values to the field
    getField(fieldname359|n).setChoices({
    texts: texts,
    values: values
    });

    // Automatically set all valid values as selected
    if (values.length > 0) {
    getField(fieldname359|n).setVal(values); // Set all valid values as selected
    }
    })();

    Thread Starter eberkland

    (@eberkland)

    Thanks. I’ll give it a try.

    Thread Starter eberkland

    (@eberkland)

    Thanks. I understand that. I just want the choices that have a value > 0 or not empty to be on the PRICING SECTION. I have to do it this way because based on the initial cost generated by the WORKSHEET customers will often say, “how much is it if I get rid of this” so salespeople can untick that line item to see the cost. Also, I have to show three different prices in the label of the checkbox (list price, manufacture discount, and promotional price) so the customer can see the value of what they are getting (that is the reason why the label is set up the way it is).

    Thread Starter eberkland

    (@eberkland)

    Thank you. I already looked through the documentation.

    I am wondering how to run a calculation in aux field and hide the button after OnClick

    Thread Starter eberkland

    (@eberkland)

    Thank you so much. Blazing fast now. Great plugin.

    Thread Starter eberkland

    (@eberkland)

    I found another direction to go since my question, but still am having issues.

    I am creating a pricing calculator using the calculated field form plugin and I want to create a pop up on the page that shows posts related to the product being priced.

    The plugin allows for setting variables on pages and then calling them, but this is not working. I am wondering if it is because the pages I am referencing are custom post types… here is some details on how this plugin sets variables https://cff.dwbooster.com/documentation/#javascript-variables

    Thread Starter eberkland

    (@eberkland)

    Thanks, I think I figured it out.

    (function() {
    var valueFromField1 = getVal(‘fieldname1’); // Get value from fieldname1
    var valueFromField2 = getVal(‘fieldname2’); // Get value from fieldname2
    var valueFromField3 = getVal(‘fieldname3’); // Get value from fieldname3
    var valueFromField4 = getVal(‘fieldname4’); // Get value from fieldname4

    // Concatenate values with additional text
    var updatedTextA = ‘Text A: ‘ + valueFromField1 + ‘, ‘ + valueFromField2 + ‘, ‘ + valueFromField3 + ‘, ‘ + valueFromField4 + ‘ – Extra text goes here’;

    getField(6).setChoices({
    texts: [updatedTextA, ‘Text B’], // Insert updated “Text A” with additional text
    values: [123, 456] // Keep values unchanged
    });
    })();

    Thread Starter eberkland

    (@eberkland)

    How would you express  <data-cff-field=”fieldname2315″> as an object.

    I am able to do this maually in the radio field label.

    • This reply was modified 1 year, 8 months ago by eberkland.
    Thread Starter eberkland

    (@eberkland)

    so would this work?

    getField(6).setChoices(texts:[‘<span class=”bprice-label-t”>Everyday</span><span class=”bprice-label-n”><span data-cff-field=”fieldname2315″ class=”bprice-w”>’, ‘choice B’], values: [fieldname4, fieldname5]);

    that is my question, in the radio button field label, I would like to put a label and values from a field, forget about the styling and classes. I want to know what type of syntax to use to make this happen.

    Thanks

    Thread Starter eberkland

    (@eberkland)

    OK, here is the question and it does not require a screenshot. In this scenario:

    getField(6).setChoices(texts:['choice A ', 'choice B'], values: [fieldname4, fieldname5]);

    Can choice A be ‘<span class=”bprice-label-t”>Everyday</span><span class=”bprice-label-n”><span data-cff-field=”fieldname2315″ class=”bprice-w”></span><span data-cff-field=”fieldname2316″ class=”bprice-w”></span><span data-cff-field=”fieldname2317″ class=”bprice-w”></span></span>’

    Can choice for texts be any sort of ‘<span data-cff-field=”fieldname2316″></span>’ to show the label and a value in the radio button.

Viewing 15 replies - 1 through 15 (of 22 total)