• Resolved benlashley80

    (@benlashley80)


    hello, is it possible to use the html field to display form input from the previous page?

    Lets say fieldname1 is text field for name: John
    and he chose two products, fieldname2: $30
    and fieldname3 $10

    on the next page can I make my form say:

    Thank you John, your total will be $40.?

    I know how to do this using read only fields but I don’t want them in text fields.

    thank you for any help!

    • This topic was modified 2 months, 3 weeks ago by benlashley80.
Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    You need only to insert an “HTML Content” field with tags like span, p, div, or any other HTML tag with the data-cff-field attribute indicating the field whose value you want to display inside the tag.

    E.g.


    <p>Thank you <span data-cff-field="fieldname1"></span>, your total will be <span data-cff-field="fieldname2"></span>.</p>

    Best regards.

    Thread Starter benlashley80

    (@benlashley80)

    I the example I gave, the total would be the sum of fieldname2 and fieldname3, how would you get the sum of those in the html? thank you.

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    You should insert a calculated field that does the sum, and then use it in the HTML Content field. For example, if you have the fieldname4 that is a calculated field with the equation fieldname2+fieldname3 The HTML piece of code in the “HTML Content” field would be:

    <p>Thank you <span data-cff-field="fieldname1"></span>, your total will be <span data-cff-field="fieldname4"></span>.</p>

    Best regards.

    Thread Starter benlashley80

    (@benlashley80)

    Ok that makes sense, thank you so much! your help for this plugin is fantastic!!

    Thread Starter benlashley80

    (@benlashley80)

    Now I have a summary field that I wish to keep hidden from public so I can display it when I want to through an html field. I don’t see a “hide from public” ticker, is there a way to do it?

    I have 11 different radio button fields, the customer will only see 1 of them depending on their age. So i used a summary field to check them all, and then I have an html page that shows everything they selected. I don’t want the summary field to show on the form until its called into the html page. How can I do this? Thanks!

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    I’m not sure about your question. However, if you want to hide a field until you display it explicitly by code, you can do the following.

    Select the field (I will assume it is the fieldname123, you should use the field name on your form) and enter the predefined class name hide-strong through its “Add CSS Layout Keywords” attribute.

    Now, if you want to display this field by pressing a button, or a script code in an “HTML Content” field, you can use the piece of code:

    SHOWFIELD('fieldname123');

    Or if you want to display it from a calculated field equation:

    SHOWFIELD(fieldname123|n);

    Best regards.

    Thread Starter benlashley80

    (@benlashley80)

    (function(){
    for(let i in typedb) {
    if(typedb[i]['type'] == fieldname240) return typedb[i]['tp'];
    }
    return '';
    })()

    Id like to do it this way, but i need to check 11 different feild for input to see what radio button is pressed, which will indicate my type. can you help me write an “or” statement or show me the best way to include 11 fieldnames in this code?

    Example of what im trying to do:

    (function(){
    for(let i in typedb) {
    if(typedb[i]['type'] == fieldname240) return typedb[i]['tp'];
    } else if(typedb[i][‘type’] == fieldname241) return typedb[i][‘tp’];}
    else if(typedb[i][‘type’] == fieldname242) return typedb[i][‘tp’];
    <!— and 9 other fieldnames —>
    }
    return '';
    })()

    I know my code is probably way off but im hoping you can understand what im attempting to do! thank you for your help!

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    The process is simpler by using the “IN” operation:


    (function(){
    for(let i in typedb) {
    if(IN(typedb[i]['type'], [fieldname240, fieldname241, fieldname242, fieldname243])) return typedb[i]['tp'];
    }
    return '';
    })()

    Learn more about the “IN” operation by reading the “Logical Operations” module documentation:

    https://cff.dwbooster.com/documentation#conditions-module

    Best regards.

    Thread Starter benlashley80

    (@benlashley80)

    thank you.

    Thread Starter benlashley80

    (@benlashley80)

    sorry if im being annoying but this has been extremely informative and helpful.

    in regards to SHOWFIELD, how would i place that in the following html?

    <b>Type:</b> SHOWFIELD('fieldname123');
    Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    SHOWFIELD does not return anything. It only displays a field hidden with CSS or by calling the HIDEFIELD operation. So, including <b>Type:</b> SHOWFIELD('fieldname123'); in an “HTML Content” field is incorrect. Also, the operations are JavaScript functions. If you insert that code directly in an “HTML Content” field, it will be identified as text.

    If you want to include the value of the fieldname123 field in the HTML Content field, you must use a tag with the data-cff-field="fieldname123" attribute as I described in a previous entry.

    Best regards.

    Thread Starter benlashley80

    (@benlashley80)

    the IN function does not seem to be working for me, can you check this for me?

    here is my calculated field function:

    (function(){
    for(let i in typedb) {
    if(IN(typedb[i]['type'], [fieldname240, fieldname236, fieldname232, fieldname228, fieldname228, fieldname220, fieldname216, feildname214, fieldname212, fieldname210, fieldname207])) return typedb[i]['tp'];
    }
    return '';
    })()

    here is the database script:

    <script>
    typedb = [
    {type: 'individual', tp: 'Individual'},
    {type: 'singleparent', tp: 'Single Parent'},
    {type: 'couple', tp: 'Couple'},
    {type: 'family', tp: 'Family'},
    {level: 'elite', lv: 'Elite'},
    {level: 'preferred', lv: 'Preferred'},
    ];
    </script>

    i’m not sure why but its not grabbing the inputs now. It was before when I was using “if AND” but i didn’t now how to include multiple fieldnames. the above code is returning blank.

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    Your question was how to implement an OR, not an AND, and your code was only checking if the value in type matches any of the fields’ values. If it is the behavior you want to implement, the code is correct. Note that I’m checking the equation structure only, and I don’t know if your fields exist on the form, or what values they have assigned.

    Please provide the link to the page containing the form.

    Best regards.

    Thread Starter benlashley80

    (@benlashley80)

    all the fields do exist. all those fields are radio button fields. im trying to check what radio is selected and then display its value. there are 11 radio fields, but only one of them are visible to the user, depending on the age of the user. so im needing to check all 11 fields to see which one was used and what was selcted. here is the link to the form. when you get to page 7, you will see “Coverage Type:” and “Coverage Level:” that is where these values should be displayed. they are text values.

    https://votesplease.com/testvote/application/

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @benlashley80

    You have some typos in the equations. In an equation, you entered feildname214 instead of fieldname214, and in another equation, you entered feildname227 instead of fieldname227

    Best regards.

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