[RESOLVED] How to open page when i click on Option values
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 ??
Code:
<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....
Re: How to open page when i click on Option values
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."
Code:
<select onchange="window.location=this.value">
Re: How to open page when i click on Option values
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
Re: How to open page when i click on Option values
Look back at my previous post. I already gave you the answer!
Re: How to open page when i click on Option values
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.
Code:
<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 ..
Re: How to open page when i click on Option values
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.
Code:
<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!
Re: How to open page when i click on Option values
It's not working. It is enter into the go() . but the JSP is not invoking at any time.
Re: How to open page when i click on Option values
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.
Re: How to open page when i click on Option values
Now it's getting. thanks.