I am trying to scrape the data from a table in the link.
https://www.chp.ca.gov/traffic
This is what I have tried, but getting blank.
wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options)
wd.get("https://www.chp.ca.gov/traffic")
html = wd.page_source
soup = BeautifulSoup(html, "lxml")
l = []
div = soup.find("div" , {"id": "pnlIncidents"})
table = div.find("table", {"id":"gvIncidents"})
for row in table.findAll(a):
l.append(row.text)
HTML
<div id="pnlIncidents" style="overflow-y:scroll;">
<div>
<table tabindex="1" cellspacing="0" rules="rows" border="1" id="gvIncidents" style="border-collapse:collapse;">
<tbody><tr class="gvHeader" style="white-space:nowrap;">
<th tabindex="1" scope="col">Details</th><th tabindex="1" scope="col">No.</th><th tabindex="1" scope="col" style="white-space:nowrap;">Time</th><th tabindex="1" scope="col">Type</th><th tabindex="1" scope="col">Location</th><th tabindex="1" scope="col">Location Desc.</th><th tabindex="1" scope="col">Area</th>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00082</td><td style="white-space:nowrap;">9:35 AM</td><td>Hit and Run w/Injuries</td><td>Nb Sr99 Jno Merle Haggard Dr</td><td>NB SR99 JNO Merle Haggard Dr</td><td>Bakersfield</td>
</tr><tr class="gvAltRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00002</td><td style="white-space:nowrap;">12:00 AM</td><td>Traffic Advisory</td><td>Bakersfield Traffic Advisories</td><td>Bakersfield Traffic Advisories</td><td>BF</td>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00091</td><td style="white-space:nowrap;">11:02 AM</td><td>CLOSURE of a Road</td><td>Cerro Noroeste Rd / Klipstein Canyon Rd</td><td> </td><td>Fort Tejon</td>
</tr><tr class="gvAltRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00074</td><td style="white-space:nowrap;">10:15 AM</td><td>CLOSURE of a Road</td><td>Klipstein Canyon Rd / Sr166</td><td> </td><td>Buttonwillow</td>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00073</td><td style="white-space:nowrap;">10:14 AM</td><td>CLOSURE of a Road</td><td>Mil Potrero Hwy / Cerro Noroeste Rd</td><td> </td><td>Fort Tejon</td>
</tr>
</tbody></table>
</div>
</div>
I have placed the requests code as a comment, you can uncomment to get the data directly from the website. But since website is unavailable at my location i have worked it for your HTML as below:-
#import requests
import pandas as pd
html = '''
<div id="pnlIncidents" style="overflow-y:scroll;">
<div>
<table tabindex="1" cellspacing="0" rules="rows" border="1" id="gvIncidents" style="border-collapse:collapse;">
<tbody><tr class="gvHeader" style="white-space:nowrap;">
<th tabindex="1" scope="col">Details</th><th tabindex="1" scope="col">No.</th><th tabindex="1" scope="col" style="white-space:nowrap;">Time</th><th tabindex="1" scope="col">Type</th><th tabindex="1" scope="col">Location</th><th tabindex="1" scope="col">Location Desc.</th><th tabindex="1" scope="col">Area</th>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00082</td><td style="white-space:nowrap;">9:35 AM</td><td>Hit and Run w/Injuries</td><td>Nb Sr99 Jno Merle Haggard Dr</td><td>NB SR99 JNO Merle Haggard Dr</td><td>Bakersfield</td>
</tr><tr class="gvAltRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00002</td><td style="white-space:nowrap;">12:00 AM</td><td>Traffic Advisory</td><td>Bakersfield Traffic Advisories</td><td>Bakersfield Traffic Advisories</td><td>BF</td>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00091</td><td style="white-space:nowrap;">11:02 AM</td><td>CLOSURE of a Road</td><td>Cerro Noroeste Rd / Klipstein Canyon Rd</td><td> </td><td>Fort Tejon</td>
</tr><tr class="gvAltRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00074</td><td style="white-space:nowrap;">10:15 AM</td><td>CLOSURE of a Road</td><td>Klipstein Canyon Rd / Sr166</td><td> </td><td>Buttonwillow</td>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00073</td><td style="white-space:nowrap;">10:14 AM</td><td>CLOSURE of a Road</td><td>Mil Potrero Hwy / Cerro Noroeste Rd</td><td> </td><td>Fort Tejon</td>
</tr>
</tbody></table>
</div>
</div>
'''
tables = pd.read_html(html)
#url = 'Enter your URL'
#html = requests.get(url).content
df_list = pd.read_html(html)
df = df_list[-1]
print(df)
Edit using BeautifulSoup
from bs4 import BeautifulSoup
html = '''
<div id="pnlIncidents" style="overflow-y:scroll;">
<div>
<table tabindex="1" cellspacing="0" rules="rows" border="1" id="gvIncidents" style="border-collapse:collapse;">
<tbody><tr class="gvHeader" style="white-space:nowrap;">
<th tabindex="1" scope="col">Details</th><th tabindex="1" scope="col">No.</th><th tabindex="1" scope="col" style="white-space:nowrap;">Time</th><th tabindex="1" scope="col">Type</th><th tabindex="1" scope="col">Location</th><th tabindex="1" scope="col">Location Desc.</th><th tabindex="1" scope="col">Area</th>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00082</td><td style="white-space:nowrap;">9:35 AM</td><td>Hit and Run w/Injuries</td><td>Nb Sr99 Jno Merle Haggard Dr</td><td>NB SR99 JNO Merle Haggard Dr</td><td>Bakersfield</td>
</tr><tr class="gvAltRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00002</td><td style="white-space:nowrap;">12:00 AM</td><td>Traffic Advisory</td><td>Bakersfield Traffic Advisories</td><td>Bakersfield Traffic Advisories</td><td>BF</td>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00091</td><td style="white-space:nowrap;">11:02 AM</td><td>CLOSURE of a Road</td><td>Cerro Noroeste Rd / Klipstein Canyon Rd</td><td> </td><td>Fort Tejon</td>
</tr><tr class="gvAltRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00074</td><td style="white-space:nowrap;">10:15 AM</td><td>CLOSURE of a Road</td><td>Klipstein Canyon Rd / Sr166</td><td> </td><td>Buttonwillow</td>
</tr><tr class="gvRow" align="left" style="white-space:nowrap;">
<td class="gvSelectColumn">Details</td><td>00073</td><td style="white-space:nowrap;">10:14 AM</td><td>CLOSURE of a Road</td><td>Mil Potrero Hwy / Cerro Noroeste Rd</td><td> </td><td>Fort Tejon</td>
</tr>
</tbody></table>
</div>
</div>
'''
soup = BeautifulSoup(html, "html.parser")
tables = soup.find('table')
table_rows = tables.find_all('tr')
res = []
for tr in table_rows:
td = tr.find_all('td')
row = [tr.text.strip() for tr in td if tr.text.strip()]
if row:
res.append(row)
Related
I'm trying to build a table in my email host for a future marketing email and I'm so darn close to finishing it up - but there's one last item that's stumping me. I'm trying to find a way to remove the extra spacing between the bullets - I know the text itself is single spaced like I want, but I don't want there to be double spacing of sorts between text items or bullets. Is there a small bit of code I can add into the below to adjust spacing between bullets to single or perhaps 1.5x?
<table>
<tbody>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:normal"><span style="font:14px arsenal"><span
style="color:#86c8c5">Cruelty Free</span></span>
</span>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:normal"><span style="font:14px arsenal"><span
style="color:#86c8c5">Vegan Friendly</span></span>
</span>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:1"><span style="font:14px arsenal"><span
style="color:#86c8c5">Refillable Bottle for Life</span></span>
</span>
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
<tr>
<td width="55"> </td>
<td style="vertical-align: top"><span style="line-height:1"><img height="30"
src="https://i.postimg.cc/52RGgKNg/63724-MYK-PP-Email-Announcement-02.png
" width="30" /></span></td>
<td width="20"> </td>
<td><span style="line-height:1"><span style="font:14px arsenal"><span
style="color:#86c8c5">Soothing Yuzu and<br />
Rice Water Formula</span></span>
</span>
</td>
</tr>
</tbody>
</table>
I want to send multiple objects from jsp file using commandname in spring form
I have searched on google and explored various sites but found no solutions of this problem
<form:form action="addproductLED"method="post"commandname="addProductLed">
<div align="center">
<h2 class="ledtechdetails">Add Led</h2>
</div>
<div style="margin-top:25px;margin-bottom:25px;">
<table border="0" cellpadding="10" cellspacing="10" class="addledtable">
<tr class="add-led">
<td class="add-led">Product Category :</td>
<td class="add-led">
<select id="productCatId"name="productCatId"class="protechname"onchange="showled('led')" required>
</tr>
<tr class="add-led">
<td class="add-led">Product Name :</td>
<td class="add-led">
<input type="text" name="productName" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product Stock :</td>
<td class="add-led"><input type="number" name="productStock" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product SKU :</td>
<td class="add-led"><input type="text" name="productsku" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product MRP :</td>
<td class="add-led"><input type="number" name="productMrp" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product Price :</td>
<td class="add-led"><input type="number" name="productprize" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product Size :</td>
<td class="add-led"><input type="text" name="productsize" class="protechname"/></td>
</tr>
<!-- another model class configuration -->
<tr class="add-led">
<td class="add-led">Resolution :</td>
<td class="add-led"><input type="text" name="resolution" class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Port :</td>
<td class="add-led">
<input type="text" name="port" class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Wifi Type :</td>
<td class="add-led"><input type="text" name="type" class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Operating System :</td>
<td class="add-led"><input type="text" name="operatingSystem" class="protechname"/></td>
</tr>
I want to get model class object in Spring Controller but I dont know how to send two model class object from one single jsp page
You can transfer multiple objects using commandname separated by semi-colon,
You have to change
<form:form action="addproductLED"method="post"commandname="addProductLed">
to
<form:form action="addproductLED" method="post" commandname="addProductLed,anotherObject" enctype="multipart/form-data">
It will send multiple object.
I'm trying to create an excel spreadsheet with a landing page where I input a specific week number, period number and/or year.
I would then click a button to open an instance of Internet Explorer, navigate to the web form, input the data from the cells in the spreadsheet and then load up the reports selected.
Code for the web form
<br>
<body>
</body>
</html>
<head>
<!--include file="../../Connections/SQL.asp" -->
<title>Performance Reporting</title>
<link href="../../CSS/KPI_Style.css" rel="stylesheet" type="text/css">
<link href="../../CSS/KPI_Style.css" rel="stylesheet" type="text/css">
<link href="../CSS/KPI_Style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style45 {color: #990000}
-->
</style>
<script type="text/javascript" language="javascript">
<!--
function makeDisable(){
var y=document.getElementById("store")
var x=document.getElementById("CHNSplits")
if (y.value=='CP11')
{
x.disabled=true
}
}
function makeEnable(){
var x=document.getElementById("CHNSplits")
x.disabled=false
}
-->
</script>
</head>
<body>
<div align="center">
<link href="../CSS/PL_Style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {font-size: 16px}
.style33 {color: #ffffff}
-->
</style>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#001446" class="border9"><div align="left"><img src="80.gif" alt="DSGi" /></div></td>
<td valign="bottom" bgcolor="#001446" class="border16"><div align="right" class="xbig style1 style33"><span class="style2">Store Performance</span> </div></td>
</tr>
</table>
<br>
<br>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
body {
background-image: url();
}
.style1 {
color: #d33;
font-size: 18px;
}
.style2 {color: #000000; font-size: 2px; }
.style10 {color: #d33}
.style15 {font-size: 12px}
-->
</style>
<title></title>
</div>
<link href="../../../Testing/KPI/NewKPI/Digital_KPI/stylesheet.css" rel="stylesheet" type="text/css">
<div align="center"><span class="reportname"> Reporting Selection</span></div>
<form name="form1" id="form1" method="post" action="Get_Page_V4.asp">
<input name="store" type="hidden" value="2397" >
<input name="ViewType" type="hidden" value="store" >
<table width="60%" border="1px" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
<td colspan="2"><div align="center" class="formnamesmall">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="4">
<td></td>
</tr>
<tr height="5">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="6"><div align="center" class="formtextverylarge">Selected Location:</span> 1111</div></td>
</tr>
<tr>
<td><input name="RadioGroup1" type="radio" value="1" checked></td>
<td class="formnamesmall" ><strong>Yesterday</td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr class="formtext">
<td><input type="radio" name="RadioGroup1" value="2"></td>
<td class="formnamesmall" ></td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall"> </td>
<td class="formtext">
<input name="datebox" type="hidden" id="datebox" value="07/10/2018" size="10" maxlength="10"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr>
<td><input type="radio" name="RadioGroup1" value="3"></td>
<td class="formnamesmall" ><strong>Week</td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Week </td>
<td class="formtext">
<input name="week" type="text" id="week" value="24" size="2" maxlength="2"></td>
</tr>
<tr>
<td> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Financial Year </td>
<td class="formtext">
<input name="weekyear" type="text" id="weekyear" value="2019" size="4" maxlength="4"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr class="formtext">
<td><label>
<input type="radio" name="RadioGroup1" value="4">
</label></td>
<td class="formnamesmall" ><strong>Period</td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Period </td>
<td class="formtext">
<input name="period" type="text" id="period" value="6" size="2" maxlength="2"></td>
</tr>
<tr class="formtext">
<td> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Financial Year </td>
<td class="formtext">
<input name="periodyear" type="text" id="periodyear" value="2019" size="4" maxlength="4"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr height="15">
<td height="10"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
<td height="10" class="formtext"></td>
</tr>
<tr class="formtext">
<td><input type="radio" name="RadioGroup1" value="6"></td>
<td class="formnamesmall" ><strong>Year </td>
<td class="formtext"> </td>
<td class="formtext"> </td>
<td class="formnamesmall">Enter Financial Year </td>
<td class="formtext">
<input name="YearYear" type="text" id="YearYear" size="4" maxlength="4" value="2019" ></td>
</tr>
<tr><td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
</tr>
<!--
<tr>
<td colspan="4"><div align="center"><span class="formnamesmall style45">Select Report Type</span></div></td>
<td> </td>
<td colspan="2" class="formname" ><strong></td>
</tr>
-->
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<td height="10"> </td>
<tr>
<!--
<td><div align="center">
<input name="RadioGroup2" type="radio" class="Style10" value="1" >
</div></td>
<td>
<div align="right" class="formnamesmall style45">
<div align="left">Charts </div>
</div></td>
-->
<input name="RadioGroup2" type="hidden" class="Style10" value="6" checked="Checked">
<!--
<td><div align="right" class="formnamesmall">
<div align="left" class="style45">League Tables
</div>
</div></td>
-->
<td class="formnamesmall" colspan="4"> </td>
<td><input type="submit" name="Submit" value="Display Report"></td>
</tr>
</table>
<p> </p>
</div></td>
</tr>
</table>
<input name="page_name" type="hidden" value="Region_Page1_" />
</form>
<br>
<br>
<style type="text/css">
<!--
.style1 {
font-size: 10px;
color: #FFFFFF;
}
-->
</style>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="bottom" bgcolor="#001446"><div align="right" class="xbig style1 style1"> </div></td>
</tr>
</table>
</body>
VBA code
Sub Get_Data()
Dim i As Long
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
Dim HWNDSrc As Long
Dim dates As Object
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.navigate "http://INTRANETSITE/Summary_Select.asp"
Do Until .readyState = 4 And Not .Busy
DoEvents
Loop
.document.all.Item("radioGroup1")(3).Checked = True 'Select the 4th checkbox down on the list
.document.forms(0).submit 'Submit the form to generate the result
End With
Pause (2)
With IE
.navigate "http://INTRANETSITE/ReportDetail2.asp?"
Do Until .readyState = 4 And Not .Busy
DoEvents
Loop
End With
End Sub
The code above navigates to the web form and does select the 4th radio button which is for period reports, then submits the form and displays the first page.
How do I interact with the text boxes to also amend which week or period I want to select reports for?
Also, when it tries to navigate to ReportDetail2.asp it returns the following error and then crashes the VBA code.
Method 'Navigate' of object 'IWebBrowser2' failed
The long term goal of this is to navigate through 20+ pages of reports, pulling the data from each table into a tab on the spreadsheet, so if it can't navigate between the reports, even before we get to the code to pull the data, then that's a problem.
Try something like the following. I am showing the different options you might consider so remember to comment out those you don't want to use.
You need to add a reference to Microsoft Internet Controls via VBE > Tools > References or use late bound call of
Dim ie As New InternetExplorer : Set ie = CreateObject("InternetExplorer.Application")
VBA:
Option Explicit
Public Sub MakeSelections()
Dim ie As New InternetExplorer
Const URL As String = "yourURL"
With ie
.Visible = True
.navigate URL
While .Busy Or .readyState < 4: DoEvents: Wend
With .document
.querySelector("[value='1']").Checked = True 'Yesterday. CSS attribute = value selector
.querySelector("[value='3']").Checked = True 'Week
.querySelector("[value='4']").Checked = True 'Period
.querySelector("[value='6']").Checked = True 'Year
.getElementById("week").Value = 6 'week value
.getElementById("weekyear").Value = 2018 'financial year value
.getElementById("period").Value = 6 'period value
.getElementById("periodyear").Value = 2018 'period financial year value
.getElementById("yearyear").Value = 2019 'financial year value
.querySelector("[value='Display Report']").Click 'display report
End With
Stop '<== Delete me later
'.Quit '<== Remember to quit application
End With
End Sub
I have a form that is in jsp at one condition the user click to view the form. When the form is render the information contain in the form should not be editable all the td should be visible but should not be editable.
for example:-
<table width="600" align="center" >
<tr>
<td class="td_left_b" width="30%">Company Name:</td>
<td width="60%" height="25"><input type="text" size="28" value="${com.companyName}" id="companyName"/></td>
</tr>
<tr>
<td class="td_left_b" width="30%">Hotel Name(Display Name):</td>
<td width="60%" height="25"><input type="text" size="28" value="${com.hotelName}" id="hotelName"/></td>
</tr>
<tr>
<td class="td_left_b" width="30%">Country:</td>
<td width="60%" height="25"><input type="text" size="28" value="" id="country"/></td>
</tr>
<tr>
<td class="td_left_b" width="30%">City:</td>
<td width="60%" height="25"><input type="text" size="28" value="${com.cityName}" id="cityName"/></td></tr>
<tr>
<td class="td_left_b" width="30%">NeighbourhoodName:</td>
<td width="60%" height="25"><input type="text" size="28" value="${com.neighbourhoodName}" id="neighbourhoodName"/></td>
</tr>
<tr>
<td class="td_left_b" width="30%">Street Name:</td>
<td width="60%" height="25"><input type="text" size="28" value="${com.streetName}" id="streetName"/></td>
</tr>
</table>
The above information i am putting through spring MODEL ATTRIBUTE in respective td. i dont want to be editable the information.
Thanks.
You cannot disable Tablecolumns. You have to disable evere input in your table.
I have the following table which sits inside an asp.net form. Im trying to process it using an onclick event on a button. but the elements are html text boxes and html check boxes all with names that are arrays
ive tried doing this
for(int i = 0; i < Request["pageimagesOrder"].Length; i++)
{
Response.Write(Request["pageimagesOrder"][i]);
}
but it just fell over. Im sure its something simple but like all things, there only simple if you know
thanks
<table>
<tr>
<td width="200"><img src="/CaptionImages/Thmbs/1.png" width="196" height="140" /></td>
<td width="300" valign="top">caption txt 1</td>
<td width="25" valign="top"><input style="width:20px;" type="text" name="pageimagesOrder[1]" value="1 "></td>
<td width="100" valign="top"><input type="checkbox" value="1" name="pageimagesDelete[]" /></td>
</tr>
<tr>
<td width="200"><img src="/CaptionImages/Thmbs/2.png" width="196" height="140" /></td>
<td width="300" valign="top">caption txt 1</td>
<td width="25" valign="top"><input style="width:20px;" type="text" name="pageimagesOrder[2]" value="2 "></td>
<td width="100" valign="top"><input type="checkbox" value="2" name="pageimagesDelete[]" /></td>
</tr>
<tr>
<td width="200"><img src="/CaptionImages/Thmbs/3.png" width="196" height="140" /></td>
<td width="300" valign="top">caption txt 1</td>
<td width="25" valign="top"><input style="width:20px;" type="text" name="pageimagesOrder[3]" value="3 "></td>
<td width="100" valign="top"><input type="checkbox" value="3" name="pageimagesDelete[]" /></td>
</tr>
<tr>
<td width="200"><img src="/CaptionImages/Thmbs/5.png" width="196" height="140" /></td>
<td width="300" valign="top">caption txt 1</td>
<td width="25" valign="top"><input style="width:20px;" type="text" name="pageimagesOrder[5]" value="4 "></td>
<td width="100" valign="top"><input type="checkbox" value="5" name="pageimagesDelete[]" /></td>
</tr>
<tr>
<td width="200"><img src="/CaptionImages/Thmbs/7.png" width="196" height="140" /></td>
<td width="300" valign="top">caption txt 2</td>
<td width="25" valign="top"><input style="width:20px;" type="text" name="pageimagesOrder[7]" value="5 "></td>
<td width="100" valign="top"><input type="checkbox" value="7" name="pageimagesDelete[]" /></td>
</tr>
</table>
You are actually naming them with the brackets []
If you write
Response.Write(Request["pageimagesOrder[1]"]) in code behind you will get a value.
You'll need to do:
Response.Write(Request["pageimagesOrder[" + i + "]"]);
That'll give you the correct naming :)