on 10-26-2007 10:05 PM
Hi guys.
I need to read a TEXT_ITEM or a DROPDOWN_ITEM of the WAD, with javascript.
This is with the 7.x version of WAD
Thanks
RGE
Hi Ricardo,
You can achieve that by creating a script item and writing the javascript in that code: I'am here showing u to do that for the text_item.
In the XHTML layout where your TEXT_ITEM tag is present please add the <span> tag like:
<span id="data" >
<bi:TEXT_ITEM name="TEXT_ITEM_1" designheight="70" designwidth="200" >
<bi:TEXT_BINDING type="CHOICE" value="CHARACTERISTIC_TEXT_BINDING" >
<bi:CHARACTERISTIC_TEXT_BINDING type="COMPOSITE" >
<bi:DATA_PROVIDER_REF value="DP_2" />
</bi:CHARACTERISTIC_TEXT_BINDING>
</bi:TEXT_BINDING>
</bi:TEXT_ITEM>
</span>
in the Script web item write the code like:
function show_data()
{
var x = document.getElementById("data") ;
var str = x.innerText;
var arr = new Array();
arr = arr.split("\n")
//Now all the data will be available in the array arr, use it like as u use an array in
C
for (i=0;i<arr.length;i++)
{
document.write( arr<i> ); //taking the value
}
}
call your function on desired action.
Please write if not clear.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry Ricardo:
Forgot to add the tag <span> in the XHTML layout for your text_item :
<span id="data">
<bi:TEXT_ITEM name="TEXT_ITEM_1" designheight="70" designwidth="200" > <bi:TEXT_BINDING type="CHOICE" value="CHARACTERISTIC_TEXT_BINDING" > <bi:CHARACTERISTIC_TEXT_BINDING type="COMPOSITE" > <bi:DATA_PROVIDER_REF value="DP_2" /> </bi:CHARACTERISTIC_TEXT_BINDING> </bi:TEXT_BINDING>
</bi:TEXT_ITEM>
</span>
and code as suggested in script item.
Hi ricardo,
Actually im not forgotting to add the tag, its not shown by the SDN.
'<' span id = "data" '>' ; Please dont put ' ' before and after the < & > tag, im doing that because msg posting other wise shows error.
<bi:TEXT_ITEM name="TEXT_ITEM_1" designheight="70" designwidth="200" > <bi:TEXT_BINDING type="CHOICE" value="CHARACTERISTIC_TEXT_BINDING" > <bi:CHARACTERISTIC_TEXT_BINDING type="COMPOSITE" > <bi:DATA_PROVIDER_REF value="DP_2" /> </bi:CHARACTERISTIC_TEXT_BINDING> </bi:TEXT_BINDING>
'<' / span '>'
please remove the spaces and ' ' from the span tag when u use it.
Hi Dipika,
I am trying to read the variable values(for further action) that I am entering in the initial selection screeen.
I am using TEXT web item but could not see
<bi:TEXT_BINDING type="CHOICE" value="CHARACTERISTIC_TEXT_BINDING"
instead it is GENERIC_text_binding. Do I have to change that manually?
Also if the text item has 2 separate objects e.g variables to be displayed how do i select both of them?
Also can i used this code with Filter pane also?
Thanks in advance
Ajay
Hi Ajay,
Good to hear that ur problem solved
Now :
1. <bi:TEXT_BINDING type="CHOICE" value="CHARACTERISTIC_TEXT_BINDING"
instead it is GENERIC_text_binding. Do I have to change that manually?
You are getting the generic binding because that the type of information you have set to fetch, you can change it, no problem but that again depends on type of information required. Explore a little on the WAD. U will get the answer.
2. Also if the text item has 2 separate objects e.g variables to be displayed how do i select both of them? - For capturing the values of two seprate values. Just insert different span id tag and do the same for other variable. - Hope that clear, if not let me know.
3. Also can i used this code with Filter pane also? - Please try that i havent done that much R & D. But i guess it will work with slight modification's.
Thanks !!
Hi ER,
1. Cant you achieve this at query level ?
At Query level you can work out like this and then use that information in WAD using text item.
Create a variable on calender date for current date, set its offset -1 (this will give you yesterdays date). Capture this variable in WAD with the help of text item.
In that case you will not need any javascript code.
But if you are talking about workin only in WAD that is you want to set value of text item always to yesterdays date then there is some coding required in JS.
Please clarify then i will be able to provide you the solution.
If its urgent then please mail me at tyagidipika@gmail.com
User | Count |
---|---|
77 | |
9 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.