• Resolved chris

    (@chris007)


    I have a Gsheet with a list of product:

    Column A: product name

    Column B: some link to jpg image (which I am free to locate wherever I want, even in the WordPress Media folder)

    I want to display the image in an area of the form based on product name selection in a dropdown.

    1./ Record set + Normal dropdown/DS Dropdown + update an HTML Element ?

    What do you suggest ?

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

    (@codepeople)

    Hello @chris007

    I’ll try to describe the process with a hypothetical example. Assuming you have the RecordSet DS field fieldname1 where each record contains two properties, column_a, and column_b. column_a is used with the DropDown DS field (fieldname2) choices’ texts and values, and column_b contains the URL to the image file. Finally, you want to display the image corresponding to the choice selected by the user in the DropDown DS field.

    In this case, I’ll use a calculated field as an auxiliary. You can hide it by ticking a checkbox in its settings.

    Insert a calculated field in the form, I’ll call it fieldname3, and enter the following equation:

    (function(){
    let records = fieldname1;
    for(let i in records) {
    if(records[i]['column_a'] == fieldname2) return '<img src="+records[i]['column_b']+">';
    }

    return '';
    })()

    The previous equation walks the record-set (fieldname1) records, and returns an IMG tag where the SRC attribute corresponds to the column_b property whose column_a matches the value selected by the user in the Dropdown DS field (column_a).

    Finally, insert an “HTML Content” field in the form where displaying the image, and enter the following DIV tag as its content:

    <div data-cff-field="fieldname3"></div>

    The data-cff-field attribute indicates the plugin the field whose value you want to display in the tag.

    Please note we are not allowed to support any customers in these forums, and the DS fields are distributed with the Developer and Platinum plugin versions.

    For pro or commercial product support please contact us directly on our site. This includes any pre-sales topics as well.

    Commercial products are not supported in these forums. We will happily answer this and any other questions you can have on our own site.

    Thank you.

    Thread Starter chris

    (@chris007)

    Hi,

    Thanks for answering so quickly, it is well appreciated.

    Let me try this.

    I have the platinium version which I bought a week ago.

    The plugin is quite usefull and made a bunch of stuff i needed. Just missing the phone field validation for international phone number so far..

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