Jump to content

From listbox to tex item


kastellu

Recommended Posts

Hello,I don't have any clue about javascript , so that is why i am asking you about this. How to writte a script that will give me a value from listbox and it would be pasted into text item or just be a text. So ,,... , value BIKE from a listbox (name of object is LISTBOX1) as an object to ,....,BIKE in a text ite (name of a text item is TEXTITEM2).Can you please give me a full script.Thank youK

Link to comment
Share on other sites

Do you need something like this, a drop down list and when you change the option it popups the value of the selectedhttp://home.hetnet.nl/~hans-kuipers4/html/listbox.htm

<html><head>	<title>My Listbox</title>  <script type="text/javascript">	function getValue(box) {if (box.selectedIndex == 0) return;alert(box.options[box.selectedIndex].value)}  </script></head><body><form name="my_form"> <SELECT id="box0" onchange="java script:getValue(this)"><option>Make your choice !<OPTION value="TEXTITEM1">Entry A<OPTION value="TEXTITEM2">Entry B<OPTION value="TEXTITEM3">Entry C<OPTION value="TEXTITEM4">Entry D<OPTION value="TEXTITEM5">Entry E<OPTION value="TEXTITEM6">Entry F<OPTION value="TEXTITEM7">Entry G<OPTION value="TEXTITEM8">Entry H</SELECT></form></body></html>

Link to comment
Share on other sites

Hello,Firstly, thanks for your replay. No that is not it! I am working in some report software, that is java coded. All objects are just drag and drop, with that i mean that you only grag a selectbox in to report and set some properties, and it works. But the only way you can customize your reports is with some HTML item , where you can write in a javascript that can corespond to that report.. The problem is that i get the values in to some selectbox (i get only need value that is prefiltered from some other object) , but since i wouldn't like to see the result in a selectbox i would like to hide that selectbox(visibility it is a propertie of this object) object and its value send to text item or tag if you like it (that tag has a object name as well). So what i am trying to do is to put that HTML object where that script would be written - select value from hidden selectbox(SELECTBOXVALUE - name) and writte it into tag object (TAGEVALUE-name) - this is only a regular tag in main page and not pop up.I hope you understand. The report software is COGNOS BI 8.2Thanks for your help!Best regards,K

Link to comment
Share on other sites

pulpfiction's code gets the selected value from a drop down menu. An alternative way to do it would be like this:If this were your HTML:

<select id="LISTBOX1"><option value="option1">Option 1</option><option value="option2">Option 2</option><option value="option3">Option 3</option></select>

You can get the selected value in your javascript like this:

var select = document.getElementById("LISTBOX1");var value = select.options[select.selectedIndex].value;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...