Hi all,
Thanks for all Servoy community who are doing a great job.
I want to share with you a problem I encountered with Calendar field,especially its format property.
I created a form with a solution form (based on an empty static form with no datasource).
I have to add fields dynamically witch can in every type (TEXT_FIELD,CHECK,CALENDAR…).
When I create a CALENDAR field, i set its format to “yyyy-MM-dd”.
It works nice if I haven’t created in the form another field with another type,But if I created
a field with another type the format is set to the default!!!
Here is a sample solution that illustrate the issue.
the check field in the main form indicate if true that you want to create a calendar field,else
it’s a textfield.
to reproduce the issue, uncheck the checkbox and click the button,
set the value,after that close the window,check the checkbox and click the button, the format is the default!
even if I remove the form from the history and set the format.
Thank you for Any explanation of this behaviour.
testCalendar.servoy (6.05 KB)
madimane:
Hi all,
Thanks for all Servoy community who are doing a great job.
I want to share with you a problem I encountered with Calendar field,especially its format property.
I created a form with a solution form (based on an empty static form with no datasource).
I have to add fields dynamically witch can in every type (TEXT_FIELD,CHECK,CALENDAR…).
When I create a CALENDAR field, i set its format to “yyyy-MM-dd”.
It works nice if I haven’t created in the form another field with another type,But if I created
a field with another type the format is set to the default!!!
Here is a sample solution that illustrate the issue.
the check field in the main form indicate if true that you want to create a calendar field,else
it’s a textfield.
to reproduce the issue, uncheck the checkbox and click the button,
set the value,after that close the window,check the checkbox and click the button, the format is the default!
even if I remove the form from the history and set the format.
Thank you for Any explanation of this behaviour.
Please add a case about this in our support system (http://www.servoy.com/s) . Why don’t you use a dynamic (solution model) frm2 ? Then it works if remove it from solution model (removeForm).
Thank you Ivostinar for your reply,
I used the clone form method of solutionModel to make up for the issue.
if(solutionModel.getForm('frm2_child') != null)
{
history.removeForm('frm2_child');
solutionModel.removeForm('frm2_child');
}
var parentForm = solutionModel.getForm('frm2');
var frmResult = solutionModel.cloneForm('frm2_child',parentForm);
...
I’ll add a case for that.
Thank you for your support ![Smile :)]()
The initial problem is related to changing the datasource for your form every time.
We’ll have to find a way to avoid it.
Yes I agree.
It would be very handy if we can change the datasource even if the form is used.
The problem is solved starting with 5.1.3; you will be able to use the code as it is in the sample solution.
Another way to do it is by calling “revertForm(…)” instead of “getForm(…)” and then you will have frm2 reverted to it’s initial state, no need to remove fields either.
By using revert it will work with your current build and the rest of your current js as well.
Thank you for your effort and your precision.