Support » Plugin: Calculated Fields Form » Managing field and urls and paramets

  • Resolved mack1990

    (@mack1990)


    Hi

    Your calculator interested me in the world of programming and I am constantly expanding my knowledge by browsing your forum / posts and learning new things.
    
    https://cff.dwbooster.com/documentation#populate-form-b-with-a
    I came across an article where you say that it is enough to use menaging field getfield (1) .setVal (2) to find the value of a calculated field.
    
    I try and it doesn't work. Do you insert this formula through html or another field?
    
    and the second question, how to use the getURLHash formula to determine the value of calculated fields? Do you need a bigger script for that?
    
    You give such a nice option as part of the pluggin, but it doesn't go anywhere. It's a pity, because this pluggin can be used not only by programmers.

    Thanks and regards,
    mack

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

    (@codepeople)

    Hello @mack1990

    The getField operation can be used only in the context of an equation. You cannot call the getField operation from any other place.

    I’m not sure what do you mean by the getURLHash and the value of a calculated field. The hash part of the URL is preceding by the # symbol. It identifies the section in the page where to jump after loading the page. The getURLHash operation returns the hash into the current URL.

    Could you describe what you need and indicate the URL of the form to verify its structure, please?

    Best regards.

    Thread Starter mack1990

    (@mack1990)

    I have interactive element which change # onclick action. I though I can set value from this to use it in equivalence.

    Can you describe me how should be insert getField tag in hipotetically formula? I mean, there is F1, in f2 I write getfield(1).setVal(3) and it cause that I can in F3 write f1*50 or f2*50 ? I need write something more or something?

    Plugin Author codepeople

    (@codepeople)

    Hello @mack1990

    The getField is an operation that receives the numeric part of a field’s name and returns its object representation. And setVal is a method that assigns a value to the field.

    Could you send me the link to the form and describe the real use case to understand your project, please?

    Best regards.

    Thread Starter mack1990

    (@mack1990)

    I just have a drawing of hotspots, and on each element there is an

    in formula a href=”#pierogi”

    element selected. I thought by the geturlhash function i could it connected with Calculated field form.

    • This reply was modified 1 month, 2 weeks ago by mack1990.
    • This reply was modified 1 month, 2 weeks ago by mack1990.
    Plugin Author codepeople

    (@codepeople)

    Hello @mack1990

    Sorry, you are making a mistake about the way browsers work.

    For example, assuming your form is located in the URL:

    https://www.yourwebsite.com/form-page

    And you have a calculated field with the equation getURLHash()

    If you visit the webpage with a hash like:

    https://www.yourwebsite.com/form-page#pierogi

    The equation value would be #pierogi

    So far so good. But you have hotspots with hashes. When you click them, the browser jumps to the tag with the id corresponding to the hash, but this action does not reload the page or tell the form it must reevaluate the equations. Your hotspots code must tell the form that should reevaluate the equation, for example, by calling the EVALEQUATIONS operation (https://cff.dwbooster.com/documentation#managing-fields-module).

    Best regards.

    Thread Starter mack1990

    (@mack1990)

    So in hypothetically formula is:

    EVALEQUATION(form, ‘fieldname1’);

    so:

    1)
    in calculated field form named fieldname2 I insert:
    EVALEQUATION(getelementbyclass*(“pierogi”).setVal(10), fieldname1**);
    or
    EVALEQUATION(getURLHash(#pierogi).setVal(10), fieldname1);

    *this class I give the css
    ** this is html content I insert into form.

    2) to make calculation with this hotspot area I make another calculated field form and make formula like usual for example: fieldname2 * 1000?

    Plugin Author codepeople

    (@codepeople)

    Hello @mack1990

    No, I’m sorry, none of these equations has sense. The getURLHash operation does not require any parameter. Furthermore, this operation returns a hash, and the hash is a text, not an object. You cannot call the setVal method for a text. And something similar happens with your other equation.

    Please, if you need a custom coding service to implement your project, you can contact me through my private website: Click Here

    Sorry, but I cannot implement your project through the WordPress forum.

    Best regards.

    Thread Starter mack1990

    (@mack1990)

    So there is way to connect hot spot with your CFF by hashes and we make huge step make solution.

    >>Return text<<, so this start interactive with the CFF.
    Now I can use any logical formula such as in another field?

    If(fieldname3 == “pierogi”) return 50;??

    My project is not secret service, just simple html css, there’s lots of page’s how to create hotspot

    I just do not understand working the ENABLEEQUATIONS(form) at all
    if I have more then “pierogi” but also “bigos”, “schabowy” and “oscypek”

    I should have form formulas like fieldname3 ENABLEEQUATIONS(geturlhash(‘pierogi’), fieldname4 “oscypek” etc ?

    Plugin Author codepeople

    (@codepeople)

    Hello @mack1990

    I said EVALEQUATIONS, not ENABLEEQUATIONS. Every time you press a hotspot, you must call the operation to evaluate the equations. Please, understand the problem is not in the form. The form does not know when you clicked on a link because they are not part of the form. You are focusing the problem in the wrong direction. Your hotspot code must tell the form when evaluating the equations.

    Best regards.

    Thread Starter mack1990

    (@mack1990)

    I am beginning to understand. I thought the calculator would see the new url #reads url displayed in the browser every time I click on the hotspot.

    you can’t force the calculator to constantly check what is # on the page?

    what things do you have to do on the hotspot side for your calculator to see it? it is about giving it an appropriate id of “fieldname999” type, some API code, or maybe JS?

    Plugin Author codepeople

    (@codepeople)

    Hello @mack1990

    You must call the EVALEQUATIONS operation, passing as parameter the form’s object. This operation evaluates the equations associated with the calculated fields in the form.

    Best regards.

    Thread Starter mack1990

    (@mack1990)

    1. to sum up, so EVALEQUATIONS I need to put in >html content< where my hotspot is and write form object fieldname3 [EVALEQUATIONS(fieldname3)] where is function “getUrlhash(pierogi). then in option2 write evelequations(fieldname4) where is “geturlhash(bigos) etc.
    and when I do it step by step, put logical formula.

    2. I also came up with a new use for this feature for me. I have a rebate program, or if someone enters the page with #summer
    will be able to have the discount calculated immediately? the above case concerned specific #pages, this one differs in that it can type anything.

    Plugin Author codepeople

    (@codepeople)

    Hello @mack1990

    Please, read the documentation of the plugin’s operations:

    https://cff.dwbooster.com/documentation#managing-fields-module

    Please, do not confuse the EVALEQUATIONS and EVALEQUATION operations. The first one evaluates all the equations associated with the calculated fields in the form and requires only one parameter, the form’s object. The second operation evaluates a specific equation and requires two parameters, the form’s object, and the field’s name.

    Furthermore, as I said in previous responses, the getURLHash operation does not require any parameter.

    If you need that someone implements your project, you can contact me through my private website. But I cannot develop your project through the WordPress forum.

    Best regards.

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