Relative path for variables (eg iformbuilder.math.sum) or passing data to parent

Comments

6 comments

  • Avatar
    blake

    If I could upvote this a hundred times, I would. Would make copying / versioning forms so much easier.

    0
    Comment actions Permalink
  • Avatar
    Hamish

    Good suggestion from one of the iForm guys is to put all of the javascript that includes absolute paths into the page level javascript - at least that way it can all be changed in one place for all the sub forms.

    0
    Comment actions Permalink
  • Avatar
    blake

    I've tried that, but having a hard time reliably triggering the functions to run. Any tips?

    0
    Comment actions Permalink
  • Avatar
    Hamish

    Apparently one key thing is that the javascript functions etc must be in the highest parent page level javascript. IE page level javascript in child forms will not be found is my understanding. I'm using function calls.

    0
    Comment actions Permalink
  • Avatar
    Hamish

    Blake - did you figure out how to separate this issue into a single function call - I haven't figured out how to do it.

    0
    Comment actions Permalink
  • Avatar
    blake

    This should work, but I haven't tested extensively. The trick, as best I can tell, is that you have to somehow trigger the JS in the Dynamic Value to run. Without the IF, it won't work. With it, it does. I have to do something similar when I have a function that is dependent on multiple widget values - write an if with a bunch of OR's on all the fields and it tends to work.

    Having said that... it doesn't really address the issue raised above since the IF statement still contains a reference to the parent form name... which is what you (and I) were trying to avoid.

    Page JS:
    function GetValue1(){
    return function_main.subf[0].value1;
    }

    Dynamic Value:
    if(function_main.subf.length > 0){GetValue1()}

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk