I'm trying to use jQuery functionality in Software AG webMethods IDE, which generates pages on its own .. Basically, I'm giving jQuery's functions a server-generated element ID, but jQuery is unable to read it's value, or write a value to it, or do anything with it ..
Here's the code I'm using:
if(jQuery.isNumeric(jQuery(CAF.model("#{activePageBean.clientIds['txtInput']}").id).val()))
{
alert("its a number");
}
else
{
alert("its not a number");
}
txtInput is a normal input text field, and the above code is assigned to a button ... And no matter what is put into the text field, I always get the "its not a number" alert ..
Also, if I use this code instead ..
alert(jQuery(CAF.model("#{activePageBean.clientIds['txtInput']}").id).val());
... I always get an alert saying "undefined" (without the double quotes) ..
The expression returning the text field's ID is:
CAF.model("#{activePageBean.clientIds['txtInput']}").id
.. and this is:
jsfwmp147312:defaultForm:txtInput
If I instead run this webMethods built-in function to get the value:
CAF.model("#{activePageBean.clientIds['txtInput']}").getValue();
It does return the value currently in the text field ..
So basically for some reason jQuery's functions are unable to 'connect' with the page's elements ..
How do I diagnose/resolve this ?
EDIT:
More information:
If I try the following code ...
var myId = "jsfwmp147312:defaultForm:txtInput";
var element = document.getElementById(myId);
alert(element.value + "");
.. I get the string text field's string value in the alert fine, no problems ... But if I try this ...
var myId = "jsfwmp147312:defaultForm:txtInput";
var val2 = jQuery(myId).val();
alert(val2);
... I get an alert with the message "undefined" (without the double quotes) ..