Support » Plugin: Calculated Fields Form » Change the label title

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

    (@codepeople)

    Hi,

    I don’t understand exactly what do you need, but in calculated fields, the result can be the text you prefer and not only a number, furthermore, with the calculated fields is possible define dependent fields, so, if the calculated price is 10, the form can display a field, but if the calculated price is a number different to 10, display another one.

    Best regards.

    Thread Starter Muhammad Sikander nasar

    (@muhammad-sikander-nasar)

    Hi,

    I have a field that have label “Select color volume”.can I change it using the if conditions.

    Like if I have price=10 then the field label will be “Select color volume” and if the price other then 10 then the label will be “Select other volume”.
    we can do this in jquery like this.

    $(‘#price’).text(‘select color volume’);

    Thanks
    Best regards

    Plugin Author codepeople

    (@codepeople)

    Hi,

    You are in the right direction.

    You simply should assign a class name to the field, through the attribute: “Add Css Layout Keywords”, to identify its label from the equations, for example: myfield

    and then modify your equation like follow:

    I will assume that the field for price is a calculated field, and that the price is calculated as fieldname1+fieldname2 (of course, the name of fields and the equation were selected randomly, only to explain the process), so the equation should be modified like follow:

    (function(){
    var price = fieldname1+fieldname2;

    if( price == 10 )
    {
    jQuery( ‘.myfield label’ ).html(‘select color volume’);
    }
    else
    {
    jQuery( ‘.myfield label’ ).html(‘select other volume’);
    }
    return price;
    })()

    Best regards.

    Thread Starter Muhammad Sikander nasar

    (@muhammad-sikander-nasar)

    Hi,

    Thanks.But this is not calculated field.this field type is number.
    Best regards

    Plugin Author codepeople

    (@codepeople)

    Hi,

    In this case the situation is similar to the previous one.

    1. Insert a calculated field in the form, and tick the option: “Hide Field From Public Page”, because this field would be auxiliary, and is not relevant in the form’s interface.

    2. Assigns the class name to the field, whose label will be edited, like in the previous ticket: myfield

    3. Finally, if the numeric field with the price is the fieldname1, the equation to associate to the auxiliary calculated field would be:

    (function(){
    if( fieldname1 == 10 )
    {
    jQuery( '.myfield label' ).html('select color volume');
    }
    else
    {
    jQuery( '.myfield label' ).html('select other volume');
    }
    })()

    and that’s all.
    Best regards.

    Thread Starter Muhammad Sikander nasar

    (@muhammad-sikander-nasar)

    Hi,

    This is my code that I am using.But this is not going to change my label.
    Can I give label or leave it blank.

    (function(){
    var v= fieldname3;
    if( v == 7777 || v == 8500  )
    {
    return PREC(8*(fieldname1/100), 2);
    jQuery( '.myfield label' ).html('select color');
    
    }
    else
    {
    return PREC(0.8*(fieldname1/100), 2);
    jQuery( '.myfield label' ).html('select other volume');
    
    }
    
    })();

    I am using three fields.
    1: The filed for which I need label.(Number field)-> this is fieldname1.I have given myfield class to this field.
    2:calculation field(that perform calculation on fieldname 1).this is fieldname2,
    3:A price field that is hidden and I will assign this value to fieldname1. This is fieldname3.

    Thanks in advance!

    Thread Starter Muhammad Sikander nasar

    (@muhammad-sikander-nasar)

    Hi,

    This is working fine.I have only change
    `jQuery( ‘.myfield label’ ).html(‘select color’);

    to

    jQuery( ‘.myfield label’ ).text(‘select color’);

    Thread Starter Muhammad Sikander nasar

    (@muhammad-sikander-nasar)

    Thank for such a nice plugin and best support.Thanks

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Thank you very much for using our plugin.

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change the label title’ is closed to new replies.