• Resolved saralanda

    (@saralanda)


    Hi,

    I have a calculator that consists first of a radio select field (fieldname59) where the user can select “Menu 1 or 2” or “Menu 3”.
    Then, depending on the url parameter “guests”, two other fields (fieldname52 and fieldname53) display a value that consists of letters, special characters, numbers, and spaces.
    The third step would be for a new field (fieldname57) to show the value of fieldname52 or fieldname53 depending if the user chose “Menu 1 or 2” or “Menu 3” on fieldname59.
    I used a calculated field with the following code for fieldname57:

    (function(){
    var result = ”;
    if(fieldname59==1) result = fieldname52;
    if(fieldname59==3) result = fieldname53;
    jQuery(‘.userselection’).html(result);
    return result;
    })()

    However, the calculated field will only display the numbers of fieldname52 and fieldname53 and ignore everything else.

    What am I doing wrong?

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

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

    (@codepeople)

    Hello @saralanda

    Thank you very much for using our plugin. If you want to access the choice text instead its value, you can use the field’s name with the |v modifier as follows:

    (function(){
    var result = '';
    if(fieldname59==1) result = fieldname52|v;
    if(fieldname59==3) result = fieldname53|v;
    jQuery('.userselection').html(result);
    return result;
    })()

    Note you have some issues in other equations, as in the following one:

    (function(){
    var result3 = '';
    if(fieldname59==1) result3 = result;
    if(fieldname59==3) result3 = result2;
    jQuery('.65caribe-4-checkout').html(result3);
    return result3;
    })()

    It includes the pieces of code result3 = result; and result3 = result2; but your equation does not define the result or result2 variables.

    Best regards.

    Thread Starter saralanda

    (@saralanda)

    The |v modifier worked perfectly. Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Calculated field will only display numbers and ignore letters’ is closed to new replies.