Click to See Complete Forum and Search --> : [RESOLVED] How to open page when i click on Option values
adusumalli
April 16th, 2009, 06:59 PM
Hi,
In my application i am using Dropdown option values. when i click on one of the option values it will open a page. I am using following code. It shows errors. Could you please help on this one ??
<select name=CATEGORY class=selInput>" );
<option value=\"#\"> ---------------- </option>
<option value="ozSetupOptValues.jsp?id=SLS_CUSTOMER_CATEGORY"> manage accounts</option> // in this line it gives problem
</select>
thanks in advance....
PeejAvery
April 16th, 2009, 09:32 PM
This is a very simple task. Any Google search could have given you the answer. There's even one on this very page called "Forum Jump."
<select onchange="window.location=this.value">
adusumalli
April 17th, 2009, 11:55 AM
In my dropdown i have 5-6 values. But i want to go that link(ozSetupOptValues.jsp?id=SLS_CUSTOMER_CATEGORY") when i choose that specific value , which i mentioned above (Manage Accounts).
thanks
PeejAvery
April 17th, 2009, 12:48 PM
Look back at my previous post. I already gave you the answer!
adusumalli
April 17th, 2009, 04:32 PM
Thanks for reply. I have 5-6 fields in drop down. But when i click on "ManageAccount" option they only it should invoke. I tried in the following way.
<select name=CATEGORY class=selInput onchange="onChange=go();">
<option value="sample1">sample1</option>
<option value="sample2">sample2</option>
<option value=\"#\"> ---------------- </option>
<option value="manageaccount"> manage accounts</option>
</select>
<head>
<script>
function go() {
window.location = "ozSetupOptValues.jsp?id=SLS_CUSTOMER_CATEGORY";
}
</script>
</head>
It is calling the JS function when i choose every option. But i need to invoke the JSP when i choose "Manage Accounts" only. Can you an idea on this ??
thanks ..
PeejAvery
April 17th, 2009, 04:46 PM
So you need to pass this as a parameter of the go() function. From within the function, you can check the value of the selected item of the <select> tag but using the parameter.
<script type="text/javascript">
function go(select) {
if (select.value == 'manageaccount') {window.location = 'ozSetupOptValues.jsp?id=SLS_CUSTOMER_CATEGORY';}
}
</script>
<select name="CATEGORY" class="selInput" onchange="go(this)">
<option value="sample1">sample1</option>
<option value="sample2">sample2</option>
<option value=\"#\"> ---------------- </option>
<option value="manageaccount"> manage accounts</option>
</select>
This really is very basic JavaScript. I highly suggest that you read up on some tutorials before proceeding and doing more scripting!
adusumalli
April 17th, 2009, 05:52 PM
It's not working. It is enter into the go() . but the JSP is not invoking at any time.
Xeel
April 17th, 2009, 06:13 PM
The code is correct, the problem must be with your JSP name or context.
Change select var name to something else, this is a reserved word, some browsers may have trouble understanding it.
adusumalli
April 17th, 2009, 06:36 PM
Now it's getting. thanks.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.