I have written a function which forms the search string by looping through all the elements in my find form and surround the field values by % so that the user can perform LIKE searches without entering the %
- Code: Select all
frmObjFind= globals.find_commonScripts('getFrmObjFind');
frmObjFind.controller.find();
var i;
for (i=0; i < frmObjFind.elements.length; i++) {
objName = frmObjFind.elements[i].getName();
// the name of the element is set exactly same as the field name
if (frmObjFind[objName] != "" && frmObjFind[objName] != null ) {
frmObjFind[objName] = "%" + frmObjFind[objName] + "%";
}
totRec = frmObjFind.controller.search();
}
This works great for the text fields. But the problem comes when search is done on an Integer field
Question:
How to get the data provider attached to an element and how to get the data type of that data provider.
If I can get this I can change my function so that it won't add any % for the Integer fields.
Since I want to generalise all the finds in the database into one common function I don't like to do any hard coding like if (field = this & that etc..)
Expecing your kind reply
Thanks