Change header text dynamically

In my project i have to select the financial year at the beginning, and i have to display in the header page the year selected by user. I used a global variable, at the first time the header displays the year, but it doesn’t update if user change the year

Anyone know how to get it to work?

Thanks!

One way to do it is using Javascript, assuming the financial_year is a select field:

  1. Go to Layout->Header and Footer. On the Header Variables, select field->financial_year for LIN1_COL1

  2. Create an ajax event on {financial_year} change and add this code:

$year = array("Financial Report: ".{financial_year});
sc_ajax_javascript(‘update_header’,$year);

  1. Create a JavaScript method, I call it update_header, and include “year” as parameter. Add this line and try:

document.getElementById(‘head_mark_financial_year_0’).innerHTML = year;

I haven’t test it but should work.
XNT

thank you for the reply,
would you correct me if i am wrong somewhere:

  • in grid application, it is not possible to define javascript methods (it doesn’t exist in SC menu of grid application)
  • in grid application, javascript code doesn’t work in onclick ajax event, i have tested this javascript code:

echo ’';

and i get a window without the “Hello word!” message(see below)

:

Haven’t tried this myself … where are you defining the global variable? Have you tried the OnHeader event?

Hello
do you have any new mobile project iOS or Android ?

Where do you select the financial year? In a form field or in grid row?

There is no global variable. In step 1 if you define that the information displayed in the header is a field and inspect the header you will find a

for head_mark_field-name_0. Then the idea is to define the new header value, in whatever event or ajax trigger, and execute the JavaScript method which will find the head_mark_field-name_0
and update its value.

This should work in a form, but bilouchka is trying to implement it in a grid.

Misael

I think this should be the solution: