473,385 Members | 1,331 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How Can I show the link based on the value selected in the drop down?

Hi to all,

I have written one jsp file. In that file, I have one drop down which contains list of request name (like student name) based on the selected value within drop down I will display the link 'Request Details(ie, Student Details)' besides that drop down.


This link is used to navigate to view the request information(ie, Student Information.)

I have written the code as follows :


In My Action Class :

Expand|Select|Wrap|Line Numbers
  1. if(interviewForm.getRequisitionName()!=null){
  2.             long reqId = Long.parseLong(interviewForm.getRequisitionName());            
  3.             request.setAttribute("requisitionId",reqId);
  4.             //System.out.println("Req Id : "+reqId);
  5.         }else{
  6.             //System.out.println("Requisition Name"+interviewForm.getRequisitionName());
  7.             request.setAttribute("requisitionId","3");
  8.             //System.out.println("In Action : "+request.getAttribute("requisitionId"));
  9.         }
  10.  
In JSP:

javascript:

Expand|Select|Wrap|Line Numbers
  1. function showlink(){
  2.         alert( 'Value: ' + document.getElementById("requisitionName").value);        
  3.           //resetVal();
  4.           disableOrEnableMarks();
  5.           var candidateId = document.getElementById("id").value;    
  6.           document.InterviewScheduleForm.action ="InterviewSchedulerAction?id="+candidateId;
  7.         document.InterviewScheduleForm.submit();
  8.     }
  9.  

Expand|Select|Wrap|Line Numbers
  1. <tr>
  2.                         <td class="Content" width="30%">
  3.                             <bean:message key="interviewscheduler.field.interviewRequisitionName" />
  4.                             :
  5.                             <span class="reddot"> *</span>
  6.                         </td>
  7.                         <td width="30%">
  8.                             <input type="hidden" name="id" value="<%=candidateId%>">
  9.                             <logic:present name="requisitionNameList" scope="request">
  10.                                 <html:select property="requisitionName" styleClass="select1" onchange ='javascript:showlink();'>
  11.                                     <html:options collection="requisitionNameList" property="id"
  12.                                         labelProperty="requisitionName"/>
  13.                                 </html:select>
  14.                             </logic:present>
  15.  
  16.                         </td>                        
  17.                         <%                                            
  18.                         int requisitionId = Integer.parseInt(request.getAttribute("requisitionId").toString());
  19.                         if(requisitionId!=3){%>
  20.                             <td><a href="javascript:showrequisitiondetails()">&nbsp;Show Requisition Details</a></td>
  21.                             <td width="20%">
  22.                                 &nbsp;
  23.                             </td>
  24.                         <% } %>
  25.                     </tr>
  26.  

Can you plzzzzzzzz help me..........

Thanks in advance
Sep 9 '08 #1
1 1674
acoder
16,027 Expert Mod 8TB
Put a link next to the drop down and set the href in showLink(), e.g.
Expand|Select|Wrap|Line Numbers
  1. // get requisite name value...
  2. // get link
  3. var link = document.getElementById("linkID").href = url + "?val=" + encodeURIComponent(reqVal);
Sep 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: deko | last post by:
I populate a drop-down list like this: echo "<select>"; foreach ( $ip_list as $var ) { echo "<option>"; echo $var; echo "</option>"; } echo "</select>";
6
by: Steve Speirs | last post by:
Hi I'm trying to show/hide a simple piece of text and a text field on a form based on what choice is made from a drop down box. <select name="dropdown" size="1"> <option selected...
4
by: Martyn Fewtrell | last post by:
I want to update a database record with a number of fields - doesn't sound to difficult at this stage! I have a system to select the correct record from the database and load the data into a...
4
by: riteshjain82 | last post by:
Hi, I am maintaining a site which is written in ASP. Now i have to create some new pages. In one page we have a table with many rows. Now, I want to enable or disable(showing and hiding also) 2...
5
by: ashok893 | last post by:
I'm using two drop down list ina form. I have generated the first drop down list from MySQL database. When i select an option from first drop down list, i have to generate second drop down list...
4
by: coldfusionstudent | last post by:
i wish to show/appear and dissappear text box based on a the drop down item selected. what do i have to add? thanks under Comm_DEV drop down selection.
2
by: giandeo | last post by:
Hello all, It's almost a couple of weeks since i am struggling to get this code work. Unfortunately, i am stuck. There seems to be no hope... Please Help....... I am working with an asp page...
1
by: deerick | last post by:
Hi there I want to know how to add a drop down list based on value from a table in an asp form. Then I want the user to be able to submit the form, and the drop down list value that they have...
3
by: jerrydigital | last post by:
good evening, I am trying to allow my users to enter in text if they don't find their option on my drop down menu. In the code below, I can get a text box to show up when I select 'Other' on the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.