Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet How to get an Id vaue

Have Programming Question? Ask it here!
 
 
 


harini
How to get an Id vaue
1 Answer(s)      4 years and 3 months ago
Posted in : JSP-Servlet


Dear Sir ,
How to get an Id value of a column when it is select ,i have to get an perticular rows Id value .I have a table with attributes like select,Id,subject,matter,status...If i select a one row i have to get a particular rows Id value.how to do this sir .I done the following things

<form name="mesdetails" method="post" action="../mesdetails.do"><input type="hidden" name="act" value="" />
<table class="ContentTable" id="results">
///following will be in the loop

<tr>
<td align="center" valign="middle"><input type="hidden"
value="<%=intId%>" name="Id"><input type="radio" name="checkBox" class="inptCheck" /></td>
<td align="center" valign="middle"><%=intId%></td>
<td align="center" valign="middle"><%=strSubject%></td>
<td align="left" valign="middle" style="padding-left:5px;word-break:break-all">&nbsp;<a href="#" name="tip"
class="tip"><%=subStringArray[0]%><span> <%=strString%></span></a></td>
<td align="center" valign="middle"><a href="<%=strMatterFile%>" name="tip" class="tip"><%=subStrFile[0]%><span><%=strFile %></span></a></td>
<td align="center" valign="middle"><%=strStatus%></td>
<td align="center" valign="middle"><%=strFrom%></td>
</tr>
//loop closed
//after
<td colspan="2" align="center">
<input type="button" class="inptButton" name="btnNew" value="New" onclick="return setaction(0,this)">
<input type="button" class="inptButton" name="btnModify" value="Modify" onclick="return setaction(1,this)">
<input type="button" class="inptButton" name="btnDelete" value="Delete" onclick="return setaction(2,this)">
<input type="button" class="inptButton" name="btnTestMail" value="Test Mail" onclick="return setaction(3,this)">
<input type="button" class="inptButton" name="btnApprovedAndSendToAll" value="Approved And Send To All" onclick="return setaction(4,this)">
</td>
<input type="hidden" name="selectedRecord" value="true"/>
</form>
<script type="text/javascript">

var pager = new Pager('results', 10);
pager.init();
pager.showPageNav('pager', 'pageNavPosition');
pager.showPage(1);

</script>

<script type="text/javascript">
function setaction(num,obj)
{
var answer=0;
if(num==0)
{
document.mesdetails.act.value = "1";
pageSubmit(obj);
return true;
}
else if(num==1)
{
document.mesdetails.act.value = "3";
return Myaction(num,obj);
}
else if(num==2)
{
document.mesdetails.act.value = "2";
return Myaction(num,obj);
}
else if(num==3)
{
document.mesdetails.act.value = "4";
return Myaction(num,obj);
}
else if(num==4)
{
document.mesdetails.act.value = "5";
return Myaction(num,obj);
}
alert("No such action found");
return false;
}
//var last = eval(eval(unescape(teks)));

function Myaction(num,obj)
{
var data="";
var count=0;
for( var i=0;i<document.getElementsByName("Id").length;i++)
{
if(document.getElementsByName("checkBox")[i].checked)
{
data +=document.getElementsByName("Id")[i].value +",";
count++;
}
}
if(count==0)
{
alert("Please select One Record");
return false;
}
else
{
data = data.substring(0,data.length-1);
document.mesdetails.selectedRecord.value = data;
if(num==1)
{
if(count>1)
{
alert("Please Select Only One Row");
return false;
}
pageSubmit(obj);
return true;
}
else if(num==2)
{
if(count>1)
{
alert("Please Select Only One Row");
return false;
}
pageSubmit(obj);
return true;
}
else if(num==3)
{
if(count>1)
{
alert("Please Select Only One Row");
return false;
}
pageSubmit(obj);
return true;
}
else
return false;
}
}

function pageSubmit(obj)
{
var namedObj = document.getElementsByName(obj.name);//I am getting error here i.e red line coming for getElementsByName() method
for(var i = 0;i<namedObj.length;i++)
namedObj[i].disabled = true;
document.mesdetails.submit();
}
function openClickedRecordDetails(Id)
{
var x = window.open("../mesdetails.do?act=1&Id="+ Id,"SingleLeaveDetail","status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,width=500,height=380");
x.moveTo(300,200);//I am getting error here i.e red line coming
}

So please help me sir if any changes

Thanks and Regards
Harini Veerapur.

Advertisement
View Answers

June 17, 2010 at 3:24 PM


Hi Friend,

Do the following:

1)modified your setaction() function

function setaction() {
var op = -1;
var ch="";
for (i=mesdetails.checkBox.length-1; i > -1; i--) {
if (mesdetails.checkBox[i].checked) {
ch = document.mesdetails.checkBox[i].value;
op = i; i = -1;
}
}
if(mesdetails.checkBox.checked){

op=i;i=-1;
}
if (op == -1) {
alert("You must select a radio button");
return false;
}
alert(ch);
return true;
}

2)add attribute 'value' in radio button

<input type="radio" name="checkBox" value="<%=id%>" class="inptCheck" />

3)Call method setaction() from the buttons.

Hope that it helps.
Thanks


Related Tutorials/Questions & Answers:
How to get an Id vaue - JSP-Servlet
How to get an Id vaue  Dear Sir , How to get an Id value of a column when it is select ,i have to get an perticular rows Id value .I have... row i have to get a particular rows Id value.how to do this sir .I done
How to get an Id vaue - JSP-Servlet
How to get an Id vaue  Dear Sir, Thanks for posting... or delete etc button i have to go that page and i want that selected id value...("./jsp/delete1.jsp"); then it sis going to that jsp where i need a id values
Advertisements
How many ways can we get the value of current session id?
How many ways can we get the value of current session id?  How many ways can we get the value of current session id
HTML Button onclick get ID of Button
HTML Button onclick get ID of Button  How i can get the ID of HTML Button on click?? I wanted to do it using JavaScript function. Thanks
how make ID - Ajax
how make ID  how make a ID in eyeball chat
get details of employee after enter the emp_id
get details of employee after enter the emp_id  how to get employee details after entered the emp_id from database after that we have three more option add new,modify and delet employee   Please visit the following
get details of employee after enter the emp_id
get details of employee after enter the emp_id  how to get employee details after entered the emp_id from database after that we have three more option add new,modify and delet employee   Please visit the following
Get Session Id
Get Session Id      ... in understanding Get Session Id .In this example we import a package... the information of the user. The servlet include the class Get Session Id,Inside
how to validate national ID number
how to validate national ID number  hey guys, plz send me a code how to vlaidate national ID number using jtextfield. in ID num thers 9 numbers +V.the V letter is included at the end of the numbers. ex:123456789V i don knw how
ID using get the databse latest value and displayed in jsp
want to get the latest value using id and displayed in that start date end date etc,... How to get latest values in my jsp page and id will be shown in url...ID using get the databse latest value and displayed in jsp  function
ID using get the databse latest value and displayed in jsp
ID using get the databse latest value and displayed in jsp   I have... in the form (it means latest values) ... how to retrive that values using ID and displayed in preview.jsp page . so technically pass the new id and display the values
id
id  how to find date of birth and gender in id in html with the help of javascript
How to code a Product id search engine?
How to code a Product id search engine?  I always wonder how people... store(just showcasing, we don't sell) each with a specific id. I am trying to code a search box that let users search products with id. Suppose, "If an user enters
Get Session Id
Get Session Id      ... the session id which was generated by the container.  HttpSession session.... There is no need to generate the unique session id. There is  no need to make
[JSP] How to pass back ID to previous page.
[JSP] How to pass back ID to previous page.  Hi experts, May I ask something. How to link a page to previous page which the content in previous page is selected from database where IDPRODUCT=". I don't know how to pass back
how to genrate login id and password after submitting the sign up form?
how he will get their login id nd passwrd automatically...how to genrate login id and password after submitting the sign up form?  i m working on a online voting project in that i have a user sign up form so
how to get radio value
how to get radio value    how to retrive the option value and insert the next table pls give example
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
How to get project path
How to get project path  my problem is,i have one jar file,in that one xml is their,i am adding this jar file to my project,my question is how i can open or get that xml path
How to get project path
How to get project path  my problem is,i have one jar file,in that one xml is their,i am adding this jar file to my project,my question is how i can open or get that xml path
How to get data datagrid ?
How to get data datagrid ?  How to get data datagrid in jsp from arrayList in java? Code in java CategoryDao dao = new CategoryDao...="#FFFFFF">id_Category</font></td> <td bgcolor="#888888
How to get Java SDK
How to get Java SDK  Hi, I have purchased a new computer and installed windows 7. Now I have to get the Java SDK and install on my computer for developing and testing Java programs. So, can anyone tell me How to get Java SDK
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE  Dear sir, Am having one table called rolemaster. In that there are 2 fields... is how to get Roleid in textbox when i select Role_name from combobox in a same
how to validate e,ail id and phne number in student form
how to validate e,ail id and phne number in student form  how to validate e,ail id and phne number in student form   Hi Friend, Visit Here Thanks
how to validate e,ail id and phne number in student form
how to validate e,ail id and phne number in student form  how to validate e,ail id and phne number in student form   Hi Friend, Visit Here Thanks
How to get factorial in mysql
How to get factorial in mysql  Hi, In order to improve the speed of my queries, one in particular tries to find matches between multiple tables, I am trying to use prime numbers to speed the process, but I have been googling
How to Get this Output
How to Get this Output  1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1   Done It public class star { public static void main(String[] args) { for(int i=1;i<=5;i
cookie creation without specifying the vaue - Java Beginners
cookie creation without specifying the vaue  how do we create cookies using java servlets by just specifying the name and not providing the value for it.because my colleague said once cookie is created value will be assigned
How i can send testing mail on my id using java?
How i can send testing mail on my id using java?  Which packages i should use to implementing java mail service??? Thanks
how to validate e,ail id and phne number in student form
how to validate e,ail id and phne number in student form  how to validate e,ail id and phne number in student form   Hi Friend, Try... { return true; } } </script> <form id="form" method="post" onsubmit
How to write a select box and id should be stored in database?
How to write a select box and id should be stored in database?  Hi, How to write a select box and select the name(devi) regarding name id(like 60... the id value into the database according to the name selected from the drop down
How to get involved
How to get involved       Shopping cart application gives you many opportunities... Application Report bugs and request features and enhancement Get familiar
How to passed the ID's in MAP how to stored whaterver select the name that only ID should store in db using SWING/AWT?
How to passed the ID's in MAP how to stored whaterver select the name that only... ever the name is selected that id should be stored in database how to passed the ID's in MAP how to stored whaterver select the name that ID should store
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
How to get the position of the comments in the pdf
How to get the position of the comments in the pdf  how to get the postion of comments, in the extracted xml, from pdf
How to use Hibernate get sessionfactory?
How to use Hibernate get sessionfactory?  Hi, How to use hibernate get sessionfactory? Thanks
how to get the checkbox value in jsp
how to get the checkbox value in jsp  how to get the checkbox value in jsp?   JSP CheckBox Example - how to get the checkbox value in jsp
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I can update my database but i want to autogenerate tasks id in numbers(ie
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I can update my database but i want to autogenerate tasks id in numbers(ie
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... tasks id as primay key, I am using JSP and struts for database connectivity,Now I can update my database but i want to autogenerate tasks id in numbers(ie
Java example program to get the object's ID
Java example program to get the object's ID       java get Object id In java there is no any specific method that provides us the object's ID. But each object has its own unique
How to Autogenerate of ID from database and show on JSP page?
How to Autogenerate of ID from database and show on JSP page?  ... entered task id,task name ,date etc properly in the database,but what and how... tasks id as primay key, I am using JSP and struts for database connectivity,Now I
how to get this xml syntx in java??????
how to get this xml syntx in java??????  how to get this xml syntx in java?????? < comp xlink:type="new" xlink:actuate="onload"/>
how to get this xml syntx in java??????
how to get this xml syntx in java??????   how to get this xml syntx in java?????? < comp xlink:type="new" xlink:actuate="onload"/>
How to get browser time zone?
How to get browser time zone?  How to get browser Time Zone and browser date using java concept
How to get Output for a Bean problem
How to get Output for a Bean problem  Hello Kindly tell me a simple Program on Bean to get the Output using JSP code
How to get a values - JSP-Servlet
How to get a values  Dear sir, I have a one form... getting a null value aprt from a attachmented file,so how to get a other values..."; action = "get.jsp"; name = "form"; id = "form
How to get enum value in Java
How to get enum value in Java  Hi all, i am looking for a solution to get an enum value from index in Java. Please suggest. Thanks
How to send the request and get the request?
How to send the request and get the request?  how to send a request to a JSP file in another domain in the same server and get the request done i.e how to include JSP file of one domain to another doamin JSP within in the same
 

 

 

DMCA.com