No announcement yet.

Can you dynamically update the menu header to show a changed value of a global var

  • Filter
  • Time
  • Show
Clear All
new posts

  • Can you dynamically update the menu header to show a changed value of a global var

    Hi All,

    There does not seem to be a definitive answer in the past forum posts, so I will ask anew.

    On the menu header i have a global variable that displays the value of the current financial year.

    I wish to allow the user to be able to temporarily set the financial year to a previous one, and I wish to update the menu header without having to run the menu app again, as this will have the effect of resetting the temporary year back to the current year.

    Is there a way to dynamically update the menu header without running the



  • #2
    Hi Tony,

    I hope I have understood.

    1.In your menu create something like this in onApplicationinit [g_Title] = '<div id="TitleDiv"> Menu </div>';
    2.In menu layout settings change the column where you want it displayed to a value of [g_title]
    3.In a grid use this on onRecord
    echo '
    top.document.getElementById("TitleDiv").innerHTML = "{your field}";


    Hope this helps


    • #3
      Thanks Mescart,

      Sadly, I cannot get it to work.

      I did number 1 and 2, and the header of the menu displays the word menu OK.

      Number 3 - you mention a grid, but I need this code to run in the ajax_on_change event of a select list. I placed the script in the ajax_on_change event but it does not update the word menu at all.

      I even placed the script in a PHP method thinking that maybe having it in a function would make a difference, but sadly no.

      I may have to lodge a support ticket to see what SC have to say.

      Many thanks anyway

      Last edited by fiscal; 09-21-2015, 12:20 AM.


      • #4
        You can try putting the code in the on-change of the select in JavaScript tab not Ajax events. You can use sc_getfield to get the value. Then again the menu app runs in a different iframe so I wonder if titlediv will be in scope.