I have a problem with application.showCalendar(). I’m building a multi purpose field for an EAV based system. The field i’m using can containt a number, a text or a date and it’s configurable by the user without using developper. Everything works well except application.showCalendar().
I’m using application.showCalendar() to popup a small calendar to choose a date and format it. So when the user clicks in my multipurpose fields, I use a on focus event to read the field type and display the right element. Here is my fonction:
function requestFocus_fr()
{
if(active)
return false;
active = 1;
application.output('resquested: ' + data_type);
switch(data_type){
case "Date" : application.setValueListItems("dynamic_list",new Array());
if(last_focus_fr != attribute_id){
var date = utils.dateFormat(application.showCalendar(),"dd/MM/yyyy");
if(date != "")
value1 = date;
else
value1 = value1;
last_focus_fr = attribute_id;
}
application.output('date');
break;
case "Boolean": last_focus_fr = attribute_id;
application.setValueListItems("dynamic_list",new Array('oui','non'));
application.output('boolean');
break;
case "Marque" : last_focus_fr = attribute_id;
query = 'select value_name from value_lists where value_list_type = "make" order by "value_name"';
var make = databaseManager.getDataSetByQuery(controller.getServerName(),query,null,-1).getColumnAsArray(1);
application.setValueListItems("dynamic_list",make);
application.output('marque');
break;
case "text_area":
last_focus_fr = attribute_id;
forms.edit_notes_fr.foundset.find();
forms.edit_notes_fr.equipment_id = equipment_id;
forms.edit_notes_fr.attribute_id = attribute_id;
forms.edit_notes_fr.foundset.search();
application.showFormInDialog(forms.edit_notes_fr,-1,-1,-1,-1,'notes',false,false,'notes',false);
controller.focusFirstField();
application.output('text_area');
break;
case "Nombre":
case "Texte" :
default : last_focus_fr = attribute_id;
application.setValueListItems("dynamic_list",new Array());
application.output('texte/nombre/default');
break;
}
active = 0;
}
When I click in a date field, the calendar pops up, I can choose a date, I can click OK and the date is placed in the field.
But then my fields become not editable!!! I can’t click in it anymore to activate the on focus event!