• Resolved eberkland

    (@eberkland)


    I have a client who wants his salespeople to show customers three prices for a product line to show them the discounts at each level. They want a toggle on/off button that will calculate when selected but they want the customer to be able to see the three different prices.

    I have been able to manually use the data-cff-field method to insert the pricing in the label of a radio button, however, since there are over 100 products this method slows down the site so much that is not usable.

    I have tried using a function to assign and set choice value method you have shown on this forum but it does not work with data-cff-field. Any suggestions for having an on/off switch, in a row, that users can select to include an item for pricing?

    Here is what works in the label field manually;

    <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>

    This is the result I am looking for:

    https://cbd.nationalpixel.com/wp-content/uploads/2024/09/Pricing-–-ClosetCalc-09-24-2024_06_04_PM.png

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @eberkland

    I’m sorry, but I cannot answer your question by looking a screenshot only. Please provide the link to the page that contains the form and describe it.

    Best regards.

    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.

    Plugin Author codepeople

    (@codepeople)

    Hello @eberkland

    In the equation context, if you want to use the fields’ names, not their values, the correct one would be fieldname2316|n with the |n modifier. The alternative would be <span class="bprice-w">fieldname2316</span>

    Best regards.

    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

    Plugin Author codepeople

    (@codepeople)

    Hello @eberkland

    No, the syntax is incorrect, you must pass an object to the setChoices method where texts and values are its properties:

    getField(6).setChoices({texts:['Text A', 'Text B'], values:[123, 456]});

    Best regards.

    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 3 weeks, 6 days ago by eberkland.
    Plugin Author codepeople

    (@codepeople)

    Hello @eberkland

    You are referring to the text of the choice. So, it is not an object, it is a string that is an item of the array of choices’ texts.

    If you need a custom coding service you should contact us directly through the plugin website,.

    Best regards.

    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
    });
    })();

    Plugin Author codepeople

    (@codepeople)

    Hello @eberkland

    I’m sorry, I don’t know who is getVal in your form.

    Remember the plugin will replace the fields’ names in the equations with their corresponding values at least you use the |n modifier with them, and you don’t need to enclose them between quotes.

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.