SnO2d
asked on
FAO: fargo
Please can you take a look at
https://www.experts-exchange.com/questions/20544953/Maintaining-Database-Tables-using-Web-Pages.html
Also, if i declare a variable
<% int rowcount = 1; %>
Can I use it in my javascript ?
Cheers
https://www.experts-exchange.com/questions/20544953/Maintaining-Database-Tables-using-Web-Pages.html
Also, if i declare a variable
<% int rowcount = 1; %>
Can I use it in my javascript ?
Cheers
>> https://www.experts-exchange.com/questions/20544953/Maintaining-Database-Tables-using-Web-Pages.html
didn't have time to read all these, how big your table are? hundred rows, thousand rows, million rows?
>> <% int rowcount = 1; %>
>> Can I use it in my javascript ?
not directly, but you can do this to assign it to javascript var:
<script>
myJSvar = <%=rowcount%>
</sript>
didn't have time to read all these, how big your table are? hundred rows, thousand rows, million rows?
>> <% int rowcount = 1; %>
>> Can I use it in my javascript ?
not directly, but you can do this to assign it to javascript var:
<script>
myJSvar = <%=rowcount%>
</sript>
Hii kenneth,
You are expert..i posted a solution for Sno2d...take a look..whether i m right or not??
impressed by you!!
regards
fargo
You are expert..i posted a solution for Sno2d...take a look..whether i m right or not??
impressed by you!!
regards
fargo
ASKER
kennethxu
at the minute my table is about 10 rows, its only likely to change + or - 2 every month. I want to apply this to other tables in the future, which will hold up to 50 rows of information, changing + or - 10 every month.
Thanks
John
at the minute my table is about 10 rows, its only likely to change + or - 2 every month. I want to apply this to other tables in the future, which will hold up to 50 rows of information, changing + or - 10 every month.
Thanks
John
may be you can have a look at this one:
<%
/************************* ********** ********** *****/
String action=request.getParamete r("action" );
String[] itemname = request.getParameterValues ("itemname ");
String[] qty = request.getParameterValues ("qty");
String[] unit = request.getParameterValues ("unit");
String[] unitprice = request.getParameterValues ("unitpric e");
String[] offerprice = request.getParameterValues ("offerpri ce");
String[] chkbox = request.getParameterValues ("chkbox") ;
boolean doDelete = "Delete Selected Item".equals( action );
boolean[] isChecked = null;
if( itemname != null ) isChecked = new boolean[ itemname.length ];
if( doDelete && chkbox != null ) {
for( int jj = 0; jj<chkbox.length; jj ++ ) {
int index = Integer.parseInt( chkbox[jj] );
// out.println( "got " + index );
isChecked[index] = true;
}
}
if (action==null) action="";
/************************* ********** ********** ********/
%>
<center>
<form method="post" name=formnewquote>
<% //if (action.equals("Submit")){ %>
<% //@include file = "process_nq1.jsp"%>
<% //} %>
<h3>Item List</h3>
<!-- Start List of Item(s) -->
<table>
<tr>
<th><div align="center"></div></td>
<th>Item Name</td>
<th>Qty</td>
<th>Unit</td>
<th>Unit Price</td>
<th>Offer Price</td>
</tr>
<%
int ii = 0;
if (itemname!=null) {
for (int k=0;k<isChecked.length;k++ ) {
if ( ! ( doDelete && isChecked[k] ) ) {
%>
<tr>
<td> <div align="center">
<input type="checkbox" name="chkbox" value="<%=ii%>">
</div></td>
<td><div align="center">
<input name="itemname" type=text value="<%=itemname[k]%>" size="17">
</div></td>
<td><div align="center">
<input name="qty" type=text value="<%=qty[k]%>" size="5">
</div></td>
<td><div align="center">
<select name="unit" >
<option value="kg" <% if ("unit[k]".equals("kg")) out.println("selected");%> >Kg</optio n>
<option value="ctn" <% if ("unit[k]".equals("kg")) out.println("selected");%> >Cartons</ option>
<option value="pkt" <% if ("unit[k]".equals("kg")) out.println("selected");%> >Packet</o ption>
<option value="tons" <% if ("unit[k]".equals("kg")) out.println("selected");%> >Tons</opt ion>
</select>
</div></td>
<td><div align="center">
<input name="unitprice" type=text value="<%=unitprice[k]%>" size="8">
</div></td>
<td><div align="center">
<input name="offerprice" type=text value="<%=offerprice[k]%>" size="8">
</div></td>
</tr>
<%
ii ++;
}
} //for
} //if
if( "Add".equals( action ) || itemname == null ) {
%>
<tr>
<td><div align="center">
<input type="checkbox" name="chkbox" value="<%=ii%>">
</div></td>
<td><div align="center">
<input name="itemname" type="text" size="17">
</div></td>
<td><div align="center">
<input name="qty" type="text" size="5">
</div></td>
<td><div align="center">
<select name="unit">
<option value="kg">Kg</option>
<option value="ctn">Cartons</optio n>
<option value="pkt">Packet</option >
<option value="tons">Tons</option>
</select>
</div></td>
<td><div align="center">
<input name="unitprice" type="text" size="8">
</div></td>
<td><div align="center">
<input name="offerprice" type="text" size="8">
</div></td>
</tr>
<% } %>
<td colspan="6">
<a href="javascript:checkall( 'formnewqu ote','chkb ox',true)" >All</a>/< a
href="javascript:checkall( 'formnewqu ote','chkb ox',false) ">None</a>
<input type=submit value="Delete Selected Item" name="action"></td>
</tr>
<tr>
<td colspan="6"><input type=submit value="Add" name="action" ></td>
</tr>
</table>
</form>
</center>
<%
/*************************
String action=request.getParamete
String[] itemname = request.getParameterValues
String[] qty = request.getParameterValues
String[] unit = request.getParameterValues
String[] unitprice = request.getParameterValues
String[] offerprice = request.getParameterValues
String[] chkbox = request.getParameterValues
boolean doDelete = "Delete Selected Item".equals( action );
boolean[] isChecked = null;
if( itemname != null ) isChecked = new boolean[ itemname.length ];
if( doDelete && chkbox != null ) {
for( int jj = 0; jj<chkbox.length; jj ++ ) {
int index = Integer.parseInt( chkbox[jj] );
// out.println( "got " + index );
isChecked[index] = true;
}
}
if (action==null) action="";
/*************************
%>
<center>
<form method="post" name=formnewquote>
<% //if (action.equals("Submit")){
<% //@include file = "process_nq1.jsp"%>
<% //} %>
<h3>Item List</h3>
<!-- Start List of Item(s) -->
<table>
<tr>
<th><div align="center"></div></td>
<th>Item Name</td>
<th>Qty</td>
<th>Unit</td>
<th>Unit Price</td>
<th>Offer Price</td>
</tr>
<%
int ii = 0;
if (itemname!=null) {
for (int k=0;k<isChecked.length;k++
if ( ! ( doDelete && isChecked[k] ) ) {
%>
<tr>
<td> <div align="center">
<input type="checkbox" name="chkbox" value="<%=ii%>">
</div></td>
<td><div align="center">
<input name="itemname" type=text value="<%=itemname[k]%>" size="17">
</div></td>
<td><div align="center">
<input name="qty" type=text value="<%=qty[k]%>" size="5">
</div></td>
<td><div align="center">
<select name="unit" >
<option value="kg" <% if ("unit[k]".equals("kg")) out.println("selected");%>
<option value="ctn" <% if ("unit[k]".equals("kg")) out.println("selected");%>
<option value="pkt" <% if ("unit[k]".equals("kg")) out.println("selected");%>
<option value="tons" <% if ("unit[k]".equals("kg")) out.println("selected");%>
</select>
</div></td>
<td><div align="center">
<input name="unitprice" type=text value="<%=unitprice[k]%>" size="8">
</div></td>
<td><div align="center">
<input name="offerprice" type=text value="<%=offerprice[k]%>"
</div></td>
</tr>
<%
ii ++;
}
} //for
} //if
if( "Add".equals( action ) || itemname == null ) {
%>
<tr>
<td><div align="center">
<input type="checkbox" name="chkbox" value="<%=ii%>">
</div></td>
<td><div align="center">
<input name="itemname" type="text" size="17">
</div></td>
<td><div align="center">
<input name="qty" type="text" size="5">
</div></td>
<td><div align="center">
<select name="unit">
<option value="kg">Kg</option>
<option value="ctn">Cartons</optio
<option value="pkt">Packet</option
<option value="tons">Tons</option>
</select>
</div></td>
<td><div align="center">
<input name="unitprice" type="text" size="8">
</div></td>
<td><div align="center">
<input name="offerprice" type="text" size="8">
</div></td>
</tr>
<% } %>
<td colspan="6">
<a href="javascript:checkall(
href="javascript:checkall(
<input type=submit value="Delete Selected Item" name="action"></td>
</tr>
<tr>
<td colspan="6"><input type=submit value="Add" name="action" ></td>
</tr>
</table>
</form>
</center>
also, you can check out the yahoo address book. you might want to implement something like that.
A request for a refund has been made. Experts you have 72 hours to object.
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
refund but do not delete. thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the jsp variables in javascript..
String somestring = "whatisthis";
say for ex: alert(<%= somestring%>)
I will take a look at ur previous post.
happy working
fargo