If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Retrieving a TextBox Prompt value from a Prompt Page with JQuery

Started by JustinCIS, 25 Apr 2013 05:21:52 PM

Previous topic - Next topic

JustinCIS

Hello!

I've been browsing the forums for a few weeks now, and figured I'd register as I've found the community here to be extremely helpful.

Anyway, I have a question regarding JQuery and TextBox Prompts in COGNOS 8.4.

In JQuery, in order to retrieve an HTML textbox value, one would do the following:

<HTML Item>

<input type="text" id="textbox1">
.
.
alert($("textbox1").val());
.
.


However, I'm having trouble doing this with TextBox Prompts.  I've read in some places that TextBox's are generate by COGNOS dynamically, so you have to append a "_textEditBox" to the front of the name.  I've also read in IBM documentation that the parameter you define in a TextBox Prompt can be accessed by appending a "p_". 

So let's say I have a TextBox Prompt that I named "endItemValue," I have attempted to retrieve it's value in the following ways:


alert($("form#_textEditBoxendItemValue").val());
alert($("#_textEditBoxendItemValue").val());
alert($("#endItemValue").val());
alert($("#p_ENDITEM_NAME").val());
alert($("#ENDITEM_NAME").val());


with no luck (all instances return "undefined")  :(

Any ideas guys?

sthabinash

I don't have much experience with JQuery but getting the value of the text prompt through javascript is done as follows
alert(getFormWarpRequest()._textEditBoxendItemValue.value);

This works when this script is in the prompt page itself. It doesnot work for other pages as the prompt exists in the prompt page as javascript doesnot seem to get prompts of other pages.

If you want to get the value of the textbox prompt of the prompt page, then you have to copy the text prompt of the prompt page in the required page and make visibility to hidden. In  doing so the text box prompt is named as 'endItemValue1'.
So the new expression becomes :
alert(getFormWarpRequest()._textEditBoxendItemValue1.value);


Hope it helps

JustinCIS

I appreciate the input.

I went ahead and did it as you instructed through standard JS. 

Thanks!