Jump to content

SDDENR

Members
  • Content Count

    17
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    SDDENR got a reaction from kpcollier in Submission Form - Display hidden fields and prepopulate fields in tables   
    I just got back to this and started looking everything over - particularly where this "function displ()" was coming from.  In my footer on the datapage I had long ago commented out some old javascript code which was either used for testing or something.  After needing to re-embed the datapage due to the old embed code no longer functioning, this commented out javascript is what started to cause the issue.  I removed this javascript and everything works fine now.   
    Thank you for pointing me in the right direction by asking me to check the code for errors in the Chrome debugger - that is what found the culprit:)
    Ron
  2. Like
    SDDENR got a reaction from BoloMinoriLop in Javascript Loop   
    In my Details page I want to display a link dependent on whether the link field in my table contains an URL. Each record contains 50+ link fields named Link1, Link2, Link3, etc.
    I have the following javascript code working to display the link only when the field has an URL present:
    if('[@field:gw_spillpdfs_link1]' != "")
    {
    var frm = "PDF1";
    document.write(frm.link('[@field:gw_spillpdfs_link1]'));
    document.write(' ');
    }
    if('[@field:gw_spillpdfs_link2]' != "")
    {
    var frm = "PDF2";
    document.write(frm.link('[@field:gw_spillpdfs_link2]'));
    document.write(' ');
    }
    Here is the issue -- rather than have 50+ IF statements I would like to do a loop to move through the fields and then break the loop when I find an empty field (all the following fields will be empty) but I am having trouble with how to place the counter variable in the @Field reference -- the following does not work and I have tried several variations -- maybe you can't even use a variable as part of an @Field reference:
    var i=1;
    for (i=1;i<=100;i++)
    {
    if ('[@field:gw_spillpdfs_link]'+ i = "")
    {
    break;
    }
    var frm = "PDF"+i;
    document.write(frm.link('[@field:gw_spillpdfs_link]'+i));
    }
    Javascript is not something I am very familiar with. If anyone can shed some light on this I would greatly appreciate it.
    Thank you,
    Ron
×
×
  • Create New...