Conditional printing

In an invoice module (“ricevute”) I need to change the value of some labels and to hide or show some field.
The method I wrote works just fine, but I can’t do the same when I load related records and try to print them in the footer.
The method is:

var tipodocumento = tipodoc 
switch( tipodocumento )  
 {  
	case "Ricevuta sanitaria":
	elements.IVAoRit.visible = false
	elements.TitRitAcc.visible = false
	elements.TotRic.text = "Tot. ricevuta"
 M-  break;  
	case "Ritenuta d'acconto":
	elements.IVAoRit.visible = true
	elements.TitRitAcc.visible = true
	elements.TitRitAcc.text = "Tot. Ritenuta/Acc."
	elements.TotRic.text = "Totale"
 M-  break;   M-  M-  M-  M- 
	case "Fattura con IVA":
	elements.IVAoRit.visible = true  
 M-  M- elements.TitRitAcc.visible = true
	elements.TitRitAcc.text = "Tot. IVA"
	elements.TotRic.text = "Tot. fattura"
	break;
	case "Fattura IVA esente":
	elements.IVAoRit.visible = false
 M-  M- elements.TitRitAcc.visible = false
	elements.TotRic.text = "Tot. fattura"
 M-  M-  M-  break;  
	default:
 M-  M-  M-  break;  
 }

I recreated the same elements into the printing form of the lineitems table (named “rigric”) and wrote a method doing erxactly the same in rigric (I called it Imposta_Etichette_Stampa). If i move manually to rigric and launch the method, everything is fine, but if I launch this method from “ricevute”:

forms.rigric.controller.loadRecords(ricevute_to_rigric)
forms.rigric.Imposta_Etichette_Stampa();
forms.rigric.controller.showPrintPreview();

the elements values are not updated. What am I missing?

Furthermore, after several experiments, I also tried a different approach: I built a form only showing the footer of ricevute and I placed it in a tabpanel inside the footer of rigric, but - even if it’s set to printable - the tabpanel remains grey when printed.

Riccardino, if I am correct it is not possible to change elements and its properties on a form that you print. So .visible, .setLocation etc won’t work. You would have to use a calculated field for this…

IT2BE:
Riccardino, if I am correct it is not possible to change elements and its properties on a form that you print. So .visible, .setLocation etc won’t work. You would have to use a calculated field for this…

Mmm… could be: but the strange thing is that not only the visibility doesn’t work, but also the text of the label are not changed.
A very strange behaviour…

JavaScript changes are not seen in printing (new panels from the repository are created), this feature is requested before and on the planning for Servoy 2.5

Jan Blok:
JavaScript changes are not seen in printing (new panels from the repository are created), this feature is requested before and on the planning for Servoy 2.5

Ok. So the alternatives are to use a calc field or different forms, right?

Yep that’s the only alternative if you want to solve this… Or wait :)