Hello All,
this was a question on how to load custom type.xmls. I found it out now, so I'm sharing it here:
I'm using a email-field in to DB-tables and wanted to use the server-side-validators here in the best way, which, according to http://www.smartclient.com/smartgwte...impleType.html is the following:
This explained in the docs. Unfortunately the example linked in the very end in the docs does not exists any more (http://www.smartclient.com/smartgwte...stomSimpleType).
You can also separate the .type.xml and .ds.xml files (e.g. put .type.xml, in one, .ds.xml in another directory) by changing server.properties like the following:
You do not need to change the DS-Loader call: "?dataSource=emailType, T_ADDRESS, ..." is just fine.
@Isomorphic: It would be great if you could re-add the example to the showcase (or correct the link in the docs, but I'm pretty sure it is gone) and include a hint to that example in the Quick Start Guide (or even add it to the QSG, if it doesn't make it too large, as this might fit very well to the Component XML chapter.)
Best regards,
Blama
this was a question on how to load custom type.xmls. I found it out now, so I'm sharing it here:
I'm using a email-field in to DB-tables and wanted to use the server-side-validators here in the best way, which, according to http://www.smartclient.com/smartgwte...impleType.html is the following:
- Create emailType.type.xml like
Code:<SimpleType name="emailType" inheritsFrom="text"> <validators> <validator type="regexp" expression="^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+(?:[a-zA-Z]{2}|[cC][oO][mM]|[oO][rR][gG]|[nN][eE][tT]|[eE][dD][uU]|[gG][oO][vV]|[mM][iI][lL]|[bB][iI][zZ]|[iI][nN][fF][oO]|[mM][oO][bB][iI]|[nN][aA][mM][eE]|[aA][eE][rR][oO]|[aA][sS][iI][aA]|[jJ][oO][bB][sS]|[mM][uU][sS][eE][uU][mM])$" errorMessage="Please enter a valid Email-address"></validator> </validators> </SimpleType>
- use it in T_ADDRESS.ds.xml like:
Code:... <field name="EMAIL" title="EMAIL" length="50" type="emailType" escapeHTML="true"></field> ...
- load types (1st) and datasources (2nd) in .html like:
Code:<script src="lms/sc/DataSourceLoader?dataSource=emailType, T_ADDRESS, ..."></script>
This explained in the docs. Unfortunately the example linked in the very end in the docs does not exists any more (http://www.smartclient.com/smartgwte...stomSimpleType).
You can also separate the .type.xml and .ds.xml files (e.g. put .type.xml, in one, .ds.xml in another directory) by changing server.properties like the following:
Code:
project.datasources: $webRoot/ds, $webRoot/types
@Isomorphic: It would be great if you could re-add the example to the showcase (or correct the link in the docs, but I'm pretty sure it is gone) and include a hint to that example in the Quick Start Guide (or even add it to the QSG, if it doesn't make it too large, as this might fit very well to the Component XML chapter.)
Best regards,
Blama
Comment