Table's row elimination based on option choosen

Table's row elimination based on option choosen

I have a drop down with yes and no option.if i select yes in a table 2 new rows are shown and if i select no another question in row appears but the space occupied by the question of yes option are still appearing in the form which should be eliminated Please help

View Answers

July 7, 2011 at 12:04 PM

Please post your code.


July 7, 2011 at 5:24 PM

<script language="JavaScript" type="text/javascript">
<!-- show hide Working/Surrendered Date
function ShowTB(obj,id1,id2,id3,id4,id5,id6,id7,id8,id9,id10,id11)
{
 txt=obj.options[obj.selectedIndex].text;
 if (txt.match('No'))
 {
  document.getElementById(id1).style.visibility='hidden';
  document.getElementById(id2).style.visibility='hidden';
  document.getElementById(id3).style.visibility='hidden';
  document.getElementById(id4).style.visibility='hidden';
  document.getElementById(id5).style.visibility='hidden';
  document.getElementById(id6).style.visibility='hidden';
  document.getElementById(id7).style.visibility='hidden';
  document.getElementById(id8).style.visibility='hidden';
  document.getElementById(id9).style.visibility='hidden';
  document.getElementById(id10).style.visibility='visible';
  document.getElementById(id11).style.visibility='visible';
 }


 if (txt.match('Yes'))
 {
  document.getElementById(id1).style.visibility='visible';
  document.getElementById(id2).style.visibility='visible';
  document.getElementById(id3).style.visibility='visible';
  document.getElementById(id4).style.visibility='visible';
  document.getElementById(id5).style.visibility='visible';
  document.getElementById(id6).style.visibility='visible';
  document.getElementById(id7).style.visibility='visible';
  document.getElementById(id8).style.visibility='visible';
  document.getElementById(id9).style.visibility='visible';
  document.getElementById(id10).style.visibility='hidden';
  document.getElementById(id11).style.visibility='hidden';
 }
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!-- show hide Working/Surrendered Date
function Show(obj,id1,id2,id3)
{
 txt=obj.options[obj.selectedIndex].text;
 if (txt.match('Yes'))
 {
  document.getElementById(id1).style.visibility='hidden';
  document.getElementById(id2).style.visibility='hidden';
  document.getElementById(id3).style.visibility='hidden';
 }


 if (txt.match('No'))
 {
  document.getElementById(id1).style.visibility='visible';
  document.getElementById(id2).style.visibility='visible';
  document.getElementById(id3).style.visibility='visible';
 }
}
//-->
</script>
</head> 
<table>
<tr> 
<td colspan="5"  bgcolor="#990000"  align="center" ><font color="white"></font><B>Network Equipments Availability</B></td> </tr>

<tr align="center" >
<th colspan="2.5"><Font color="Red">*</Font><b>Is there a router available at the site :</b></th>
<th colspan="2.5">
<select name="router" onchange="ShowTB(this,'fred1','fred2','fred3','fred4','fred5','fred6','fred7','fred8','fred9','fred10','fred11');">
<option value="-1">Select</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</th>
</tr>
<tr> 
<th id="fred1" colspan="5"  bgcolor="#990000" style="visibility:hidden;" align="center" ><font color="white"></font><B>Give the following Details</B></th> </tr>

<tr> 

<th id="fred2" align="left" bgcolor="#CCCCCC" style="visibility:hidden;" ><Font color="Red">*</Font><b>Mark</b></th>
<td>
<input id="fred3" style="visibility:hidden;" type="text" name="mark"  size="30"  ></td>

<th id="fred4" align="left" bgcolor="#CCCCCC" style="visibility:hidden;" ><Font color="Red">*</Font><b>Model</b></th>
<td>

<input id="fred5" style="visibility:hidden;" type="text" name="model"  size="30"  ></td>
</tr>

<tr>
<th id="fred6" align="left" bgcolor="#CCCCCC" style="visibility:hidden;" ><Font color="Red">*</Font><b>Sr no</b></th>
<td>
<input id="fred7" style="visibility:hidden;" type="text" name="sr no"  size="30"  ></td>



<th id="fred8" align="left" bgcolor="#CCCCCC" style="visibility:hidden;" ><Font color="Red">*</Font><b>Accesories/Card</b></th>
<td>
<input id="fred9" style="visibility:hidden;" type="text" name="card"  size="30"  ></td>

</tr>



<tr align="center" >
<th id="fred10" align="center" colspan="2.5" bgcolor="#CCCCCC" style="visibility:hidden;" ><Font color="Red">*</Font><b>Does a new Router is required to be processed:</b></th>
<td id="fred11" colspan="2.5" align="left" bgcolor="#CCCCCC" style="visibility:hidden;" >
<select name="info" onchange="Show(this,'fred12','fred13');" >
<option value="-1">Select</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</td>
</tr>

<tr align="center" >
<th id="fred12" align="center" bgcolor="#CCCCCC" colspan="2.5" style="visibility:hidden;" ><Font color="Red">*</Font><b>Is the Router made available from existing stock:</b></th>
<td id="fred13" align="left" bgcolor="#CCCCCC" style="visibility:hidden;"colspan="2.5" >
<select name="stock"  >
<option value="-1">Select</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</td>
</tr>
<tr>

<td  align="center"colspan="2.5" bgcolor="#CCCCCC" text="italic"><Font color="Red">*</Font><b>Any Router Acessories needs to be procured?</b></th> 
<td colspan="2.5">
    <input type="text" name="Acc" size="48" style="background-color:#FFFFCC;">

    </td> 

</tr>
</table>

if i select yes ,then 3 rows appears and occupy the space. if i select no, then question for no appears but the space for 3 row is jst hidden and a long gap appears between the question. plz run the code and see result and plz help me thanks


July 11, 2011 at 2:31 PM

Please give me the solution soon..Its urgent thanks

Ads









Related Tutorials/Questions & Answers:
Table's row elimination based on option choosen
Table's row elimination based on option choosen  I have a drop down with yes and no option.if i select yes in a table 2 new rows are shown and if i select no another question in row appears but the space occupied by the question
include a delete option in every row of table in a JSP page
include a delete option in every row of table in a JSP page  I have the following code of a JSP page........... <blockquote> <p>...; <body> <table border="1"> <tr><
Advertisements
delete row from a table in hibernate
delete row from a table in hibernate  is there method to delete row in a table using hibernate like save(-) to insert row
add image in a row of table
add image in a row of table  i have a table in which i have to add image in its row.i am trying to add the image with the help of label i.e i have... jLabel.setIcon(new ImageIcon("E:/2.jpg"));.But when i pass this jlabel in the row it shows
add image in a row of table
add image in a row of table  i have a table in which i have to add image in its row.i am trying to add the image with the help of label i.e i have... jLabel.setIcon(new ImageIcon("E:/2.jpg"));.But when i pass this jlabel in the row it shows
Adding button to each row for the table and adding row to another table
Adding button to each row for the table and adding row to another table  Hi I need to add button to each line in the table(Table data is retrived... row of the table
JavaScript add row dynamically to table
JavaScript add row dynamically to table  ... to add row to a table dynamically then we can also do this with the JavaScript code. In this example we will describe you how to add row dynamically to the table
Deleting a Row from SQL Table Using EJB
Deleting a Row from SQL Table Using EJB   ... to delete a row from the SQL Table. Find out the steps given below that describes how to delete a particular row from the database table using EJB. The steps
Insert specific fields into table dynamically for each row.
Insert specific fields into table dynamically for each row.  There is a table containing 20 fields and 2 of those are empty. The administrator... into the table. For this all the rows displayed and two rows with empty text boxes, he
Insert specific fields into table dynamically for each row.
Insert specific fields into table dynamically for each row.  There is a table containing 20 fields and 2 of those are empty. The administrator... into the table. For this all the rows displayed and two rows with empty text boxes, he
JavaScript add row to table
JavaScript add row to table      ... will get the table containing the columns Name and Address and a button 'Add row'. On clicking the button, a new row will be added to the table.  Here is the code
delete row from a table using hibernate
delete row from a table using hibernate  //code in java file String hql="delete from CONTACT c where ID=6"; Query query=session.createQuery(hql); //error when executing above code CONTACT is not mapped
How to add dropdown list in a row of a sort table applet?
How to add dropdown list in a row of a sort table applet?  How to add dropdown list in a row of a sort table applet
JDBC Delete Row In Table Example
JDBC Delete Row In Table Example : In this tutorial we will learn how delete specific row from the table use mysql JDBC driver.This tutorial defined how one or more specific  row delete from table that follow any given condition
How to search the selected item in row table using radia button in JSP?
How to search the selected item in row table using radia button in JSP?  How to search the selected item in row table using radia button in JSP
Add values of drop down menu( select option) to mysql table
Add values of drop down menu( select option) to mysql table   Here is my code <?php echo $row['valveName'].'<td>'.$row...;option value="ON">ON'; echo '</option>'; echo '<option
Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below
Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below  HI, I have... the table rows up to view more underlying data, then, the table's header (1st row
Query to insert values in the empty fields in the last row of a table in Mysql database?
Query to insert values in the empty fields in the last row of a table in Mysql... row of my MYSQL database. Now I want to fill up those empty fields in the last row. So what will be the query
show folder on server by clicking a row in table using jsp and ajax
show folder on server by clicking a row in table using jsp and ajax  Hi, i want a jsp page which has one dropdown and one textfield. when i click... display the table. Now if i click on a row it should open a folder in server
show folder on server by clicking a row in table using jsp and ajax
show folder on server by clicking a row in table using jsp and ajax  Hi, i want a jsp page which has one dropdown and one textfield. when i click... display the table. Now if i click on a row it should open a folder in server
Delete a Specific Row from a Database Table
Delete a Specific Row from a Database Table   ... the facility for deleting specific row in a database table. Sometimes, you want... the connection we are going to delete a specific row from the table. If the row
How to change table row color when click on Hyper Link in jsp?
How to change table row color when click on Hyper Link in jsp?  I use 5 links: Link 1 Link 2 Link 3.. table: row1 row2 row3.. when click on the link1 automatically change
How to identify the radio button id and row id in a table in jsp?
How to identify the radio button id and row id in a table in jsp?   function generateid(no) {var table..."+no; } function addRow(tableID) { var table
Deleting a Row from SQL Table Using EJB
Deleting a Row from SQL Table Using EJB... are going to delete a row from the SQL Table. Find out the steps given below that describes how to delete a particular row from the database table using EJB
How to get table row contents into next jsp page
How to get table row contents into next jsp page  Hi, I have a 30... page.But the problem is how do i get the selected radio button table row... code retrieve data from database and display in the html table. At each row
how to display the selected row from the data table in model panel ??
how to display the selected row from the data table in model panel ??  the below displayed is my datatable:tableDatas.xhtml <rich:dataTable value="#{tableRecordBean.dataList}" var="dataItems" onRowClick="#{rich
Delete row and column from table through java code
Delete row and column from table through java code... will see how to delete row and column from given table through java code. Java code...' and a table 'stu_info' in same database. Structure of table 'stu_info
How to Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database(MySql)?
How to Dragging and dropping HTML table row to another position(In Jsp... have one Html table in jsp page and i am iterating values (in columns of html table)from Database, Now i am Dragging and dropping one HTML table row to another
Dragging and dropping HTML table row to another position(In Jsp) and save the new position (values) also in database
Dragging and dropping HTML table row to another position(In Jsp) and save... table in jsp page and i am iterating values (in columns of html table)from Database, Now i am Dragging and dropping one HTML table row to another position.I
ModuleNotFoundError: No module named 'double-elimination'
ModuleNotFoundError: No module named 'double-elimination'  Hi, My... named 'double-elimination' How to remove the ModuleNotFoundError: No module named 'double-elimination' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'single-elimination'
ModuleNotFoundError: No module named 'single-elimination'  Hi, My... named 'single-elimination' How to remove the ModuleNotFoundError: No module named 'single-elimination' error? Thanks   Hi, In your

Ads