I have a table that is generated after a search is run (the search is run by entering a set of numbers which represent student ID's ex. student 1 ID: 648892, student 2 ID: 648337, student 3 ID: 648832.
After the search the table contains ID's of students that match the criteria of the search.
It is possible to enter partial IDs, so when all matching students are generated into the table, there may return more than one student. So far example, if "6488" is searched, it will return students 1 and 3.
Table columns: studentID DOB grade etc... Each row is a unique student.
I want the first column (studentID) to be a hyperlink that when clicked on, the value of the hyperlink (the studentID) will be loaded into the initial search box.
(This needs to be done in the decorator class, using javascript)
Here is what I have....
public String getStudentID(){
Student row = (Student) getCurrentRowObject();
StringBuilder sb = new StringBuilder();
sb.append("<a href=javascript:retrieveStudent(" + row.getStudentNumber()+ ")>");
sb.append("<a href=javascript:populateSearchText(document.getElementById("selectedStudent.select.id"), "StudentTextId"); >");
sb.append(row.getStudentNumber() +"</a>");
return sb.toString();
}
What it does is create the link on the column, however it does not load the value of the link (studentID) to the textbox. Any ideas?
Have tried the following methods:
jquery: populate textbox with value of hyperlink
How to populate textbox with data , using selected combobox items