• Resolved hsntgm

    (@hsntgm)


    First of all, thanks for this great plugin.It makes amazing things.

    I read your “How to assign a value to a field that is not a calculated field from an equation?” tutorial but it doesn’t solve my problem.

    I have 1 calculated field, 1 Instruct. text area and 1 button. I want to do that when click the button assign calculated field value to insctruc.text .uh element.

    I tried jQuery( ‘.myclass .uh’).html( fieldnameX ); but it gives me error fieldnameX isn’t defined.

    Thanks in advance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter hsntgm

    (@hsntgm)

    Edit:

    Sorry for double post. I had a logic problem which i have just realised. My problem is also changed that i described previous post.

    First i managed to get fieldnameX value from field with below code. When button clicked it set value of instruc.text .uh element. Maybe it can be helpful someone.

    jQuery( ‘.myclass .uh’).html( jQuery(‘[id*=”fieldname’+’X_”]’).val() );

    But when button clicked and passed next page fieldnamex hasn’t been calculated yet. ?? So i have a value 0.

    Finally, my question is, have three input fields (number) and 1 calculated field (fieldnamex) which has calculation – input field 1 * input field 2 * input field 3-.

    I want to do that while user filling these input fields the calculated result show in insctruc.text .uh element dynamically.

    Thanks,

    Plugin Author codepeople

    (@codepeople)

    Hello,

    Please, insert the value into the tag from the equation, for example, if the current equation is:

    fieldname1*fieldname2*fieldname3

    you simply should modify it as follows:

    (function(){
    var v = fieldname1*fieldname2*fieldname3;
    jQuery( '.myclass .uh').html(v);
    return v;
    })()

    Best regards.

    Thread Starter hsntgm

    (@hsntgm)

    It is working:) I strongly advise this plugin.

    Best plugin bonus +best support. After my project done I’ll share how talented this plugin is..

    Thanks.

    Thread Starter hsntgm

    (@hsntgm)

    I have one more issue.

    (function(){
    var v = fieldname1*fieldname2*fieldname3;
    jQuery( ‘.myclass .uh’).html(v);
    return v;
    })()

    When form user hide these input values (fieldname1,fieldname2 and fieldname3) for example by remove this section button I hide them with Jquery hide() and could be entered some values already so i assign to these fields new val(‘0’) to reset fields for get new fresh calculation. But after new values assigned it still brings and write old calculated values to instr.text .uh field. Maybe it doesn’t calculate it with new assigned values because of hide() or javascript cache i don’t know.

    I will need your extra customization (Instant Bid -print to pdf and send e-mail to customer and save database 1 copy for us) at the end of the project. I hope we can migrate my project with your paid version.But i believe i can handle these small parts of project it is enjoyable.

    Thanks.

    • This reply was modified 7 years, 10 months ago by hsntgm.
    • This reply was modified 7 years, 10 months ago by hsntgm.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    I’m sorry, but I don’t understand your form’s structure, however, if you want multiply the fields only if the fields are visible, the equation would be:

    (function(){
    var v = 1;
    if( jQuery('[id*="fieldname1_"]').is(':visible')) v *= fieldname1;
    if( jQuery('[id*="fieldname2_"]').is(':visible')) v *= fieldname2;
    if( jQuery('[id*="fieldname3_"]').is(':visible')) v *= fieldname3;
    jQuery( '.myclass .uh').html(v);
    return v;
    })()

    However, if you need additional help with your equation, I can offer you a custom coding service through my website:

    https://cff.dwbooster.com/customization

    Best regards.

    Thread Starter hsntgm

    (@hsntgm)

    Simply when i change input field values internally (without user touch) for example by onclickevent jQuery(‘[id*=”fieldname3_”]’).val(0) calculated fields don’t read the new values which has been assigned internally and continue to calculate them with previously entered (user touched) values.

    Thanks.

    • This reply was modified 7 years, 10 months ago by hsntgm.
    • This reply was modified 7 years, 10 months ago by hsntgm.
    • This reply was modified 7 years, 10 months ago by hsntgm.
    • This reply was modified 7 years, 10 months ago by hsntgm.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    If you want assign a value to the fieldname3 field, and call all equations that dependen of the fieldname3, you simply should call the “onchange” event of the fieldname3 field, as follows:

    jQuery('[id*="fieldname3_"]').val(0).change();

    Best regards.

    Thread Starter hsntgm

    (@hsntgm)

    Hi,

    Not working,

    I added your code to my button’s onclick event area still when user click the button the other calculated fields which depends to fieldname1,fieldname2 and fieldname3 don’t change.

    jQuery(‘[id*=”fieldname1_”]’).val(0).change();
    jQuery(‘[id*=”fieldname2_”]’).val(0).change();
    jQuery(‘[id*=”fieldname3_”]’).val(0).change();

    Maybe i need a code when my button clicked, reset only these specific three fields (not whole form)!. Because if i choose button type *reset in plugin it calls all equations with new assigned values but i don’t want to reset whole form.

    Thanks for your effort.

    Edit:
    I managed to solve it. I changed button type *calculate* in the plugin. ??

    • This reply was modified 7 years, 10 months ago by hsntgm.
    • This reply was modified 7 years, 10 months ago by hsntgm.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    If you select as the button type the “Calculate” option, you don’t need to assign the value to the field and triggering an “onchange” event, from the onclick event of the button, because the “Calculate” buttons evaluate all the equations in the form.

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Assign calculated field value to Instruc.Text by button onclick event.’ is closed to new replies.