Page 1 of 1
Adding Existing Properties to new Widgets.
Posted: Thu May 15, 2014 2:52 pm
by mpilo0
Hi, Sorry for all the questions we are still making our first widgets from scratch.
We would like to know if it is possible to add existing properties (In my case the required validation) to new widgets.
Ex: We made a custom Date Picker that offered us a few more options that we needed, however the new Date Picker doesn't have the validations. I was wondering if it would be possible to change the controls of the required validation to add our widget to the list of controls.
Thanks again for your help!
Re: Adding Existing Properties to new Widgets.
Posted: Tue May 20, 2014 10:32 am
by David
Sorry for the late response, I was researching this.
Unfortunately, there is not a way to add properties from the pre-built widgets onto a custom widget. You get just the basic set of properties, plus any that you add on your own.
Re: Adding Existing Properties to new Widgets.
Posted: Tue May 20, 2014 11:17 am
by mpilo0
In that case, if we were to make our own property for the required, how would we plug ourselves into the validations that profound does before going back to the server?
Re: Adding Existing Properties to new Widgets.
Posted: Tue May 20, 2014 11:40 am
by dieter
Hello,
maybe we had a similar problem. We also wanted to improve the date field widget. In our case the users wanted that the date entry is automatically formatted when they are typing the date. We solved this problem by writing a little bit of Javascript
We wrote 3 Javascript functions which are bound to 3 events (onChange, OnKeyDown and OnKeyUp) on every datefield. The functions make an instant validation of the typed data. Because we created our own date widget by deriving the Profound date widget we don't have to bind the functions to the events manually.
Dieter
Re: Adding Existing Properties to new Widgets.
Posted: Tue May 20, 2014 11:47 am
by dieter
Here is an example of such a funktion:
//-----------------------------------------------------------------------------------------------------------
// Formatting the date while the user types it. This funktion usually is called by onkeyup event:
// The German date format is DD.MM.YYYY. E.g. 20.05.2014
//-----------------------------------------------------------------------------------------------------------
editDate : function(event, element) {
// if a digit is typed:
if (ecc.keyCode_isDigit(event.keyCode)){
if (element.value.length==2) {
element.value = element.value + ".";
}
if (element.value.length==5) {
element.value = element.value + ".";
}
}
},
Dieter
Re: Adding Existing Properties to new Widgets.
Posted: Wed May 21, 2014 10:13 am
by mpilo0
The problem is that those events already exist. We need to create a new widget because we are adding properties. We want the properties to only apply to the widget we are making. So we can't do it that way.