Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
365
igtxt:WebTextEdit to execute a Javascript function
posted

Hi, I need help please.


I have a javascript function within a xslt file.

On my dev tool, I have a WebTextEdit box with the properties & events.
on the KeyPress event i want to add the javascript function IsNumeric().

var edit = igedit_getById("FG2100RefNo"); IsNumeric(edit);

but i get the the error: can't eval.


Please Assist, Regards!

 

  • 365
    posted

    Hi, I have been struggling.

    I assumed I had to insert the javascript within the xslt file that builds the objects.

    This will be great if i can add the function directly to the event.

    var edit = igedit_getById("FG2100RefNo");var editText = edit.getText();alert(!isNaN(editText);

    But i get the error: Can't Eval var edit = igedit_getById("FG2100RefNo");var editText = edit.getText();alert(!isNaN(editText);

    Secondly, is there a way of not allowing numeric at all instead of the alert.

    Thank You

  • 28464
    posted

    Hello,

    I am not sure how the XSLT file is related to the scenario, but I assume that you want to check if the value of an WebTextEdito control is numeric. In fact, I am not sure that IsNumeric function exists in Javascript, you can try to check it either using regular expressions (there are plenty of examples online) or using the opposite built-in javascript function isNaN (is not a number) documented here:

    http://www.w3schools.com/jsref/jsref_isNaN.asp

    So the javascript may look something like this:

    var edit = igedit_getById("FG2100RefNo");

    var editText = edit.getText();

    alert(!isNaN(editText);

    More info on the client side object model of the edit control can be found here:

    http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebTextEdit_Object_CSOM.html