WebtextEdit executes Javascript function

I need to execute all JavaScript function.

Found what I was doing wrong:

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

      

But this only checks and displays a message box.

I need to execute the below JavaScript:

<script language=Javascript>
  <!--
  function isNumberKey(evt)
  {
     var charCode = (evt.which) ? evt.which : event.keyCode
     if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;

     return true;
  }
  //-->

      

onkeypress="return isNumberKey(event)"

      

How can I do this using webtextedit:

var edit = igedit_getById("FG2100RefNo");
var editText = edit.getText();
function isNumberKey(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
    return true;
}
return isNumberKey(editText)

      

I only have the property value onkey

to insert the code.

0


source to share


2 answers


Your function is onkeypress="return isNumberKey(event)"

sufficient to force only the number of users.



0


source


You can specify a client function name for ClientSideEvents.KeyPress

the server side control .

FROM#:

FG2100RefNo.ClientSideEvents.KeyPress = "isNumberKey";

      



you will need to update the definition isNumberKey

to accept the supplied parameters and use the control method to reverse the action.

ClientSideEvents link: http://help.infragistics.com/Help/NetAdvantage/ASPNET/2009.1/CLR3.5/html/Infragistics35.WebUI.WebDataInput.v9.1~Infragistics.WebUI.WebDataInput.WebTextEdit~Clientml.html

0


source







All Articles