dynamically mask

I have some custom fields for the end-user. As I cannot create a dynamic form easily I am showing and hiding fields when needed. For date fields I have a simple mask. But if I use a global variable in the mask field it is not replaced by the global I gave. I.e. in onscriptinit or onload:

[glob_datemask]=‘99-99-9999’;

leads to:

NM_tab_crit[2] = new NM_critica(‘F1’, ‘activitytimeinfo’, ‘activitytimeinfo’, ‘[glob_datemask]’, ‘lista’, ‘cxab’, 50, ‘TUDO’);

It is highly appreciated that global variables or field variables are allowed in the mask-field.

Another nice option would be to be able to change the field type. In that case it would be possible to change a text field to date and have the date select box shown.