Jump to content

kwilliams

Members
  • Content Count

    229
  • Joined

  • Last visited

Everything posted by kwilliams

  1. I received this response from someone else: Are you saying that what's mentioned is not possible? Thanks for your help.
  2. I have a stored procedure (SP) that imports 2 internal XML feeds into a SQL Server 2005 table using Bulk Load/OPENROWSET without a problem. But I'd also like to import one more external XML feed that's not located on my domain into that same SP. When I enter the URL to that XML feed, I get this error message when I run the job:Msg 4861, Level 16, State 1, Line 2Cannot bulk load because the file "http://codeamber.org/a1xl04act/amberalert.xml" could not be opened. Operating system error code 123(The filename, directory name, or volume label syntax is incorrect.).(1 row(s) affected)From research, I'm *thinking* this is an issue regarding accessing data from another site/domain, but I can't say for sure. I'm able to do this in ASP.NET/VB.NET code without a problem, so I'm not sure why it wouldn't work within SQL Server 2005 somehow. I'm including the entire SP code below. If anyone can let me know what I'm doing wrong, it would be greatly appreciated. Thanks.spXMLImport: USE [DATABASENAME]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[spXMLImport]ASBEGINSET NOCOUNT ON;DROP TABLE tblXMLFeedsCREATE TABLE tblXMLFeeds( record_id VARCHAR(50), xmlTitle VARCHAR(100), xmlFileName VARCHAR(300), xml_data xml, datestamp VARCHAR(23))DECLARE @record_id_aa VARCHAR(50)DECLARE @record_id_bb VARCHAR(50)DECLARE @record_id_cc VARCHAR(50)DECLARE @xmlTitle_aa VARCHAR(100)DECLARE @xmlTitle_bb VARCHAR(100)DECLARE @xmlTitle_cc VARCHAR(100)DECLARE @xmlFileName_aa VARCHAR(300)DECLARE @xmlFileName_bb VARCHAR(300)DECLARE @xmlFileName_cc VARCHAR(300)DECLARE @datestamp VARCHAR(23)SELECT @record_id_aa = 'aaID'SELECT @record_id_bb = 'bbID'SELECT @record_id_cc = 'ccID'SELECT @xmlTitle_aa = 'Internal Feed 1'SELECT @xmlTitle_bb = 'Internal Feed 2'SELECT @xmlTitle_cc = 'External Feed'SELECT @xmlFileName_aa = '\\SERVERNAME\DIRECTORY\docs\xml\internalfeed1.xml'SELECT @xmlFileName_bb = '\\SERVERNAME\DIRECTORY\docs\xml\internalfeed2.xml'SELECT @xmlFileName_cc = 'http://codeamber.org/a1xl04act/amberalert.xml' --<<<----EXTERNAL FEED--******************I'VE ALSO TRIED THE FOLLOWING:******************--SELECT @xmlFileName_cc = '//codeamber.org/a1xl04act/amberalert.xml'--SELECT @xmlFileName_cc = '\\codeamber.org\a1xl04act\amberalert.xml'--SET datestamp as ISO-8601 datetime formatSELECT @datestamp = CONVERT(VARCHAR(23), GETDATE(), 126)EXEC('INSERT INTO tblXMLFeeds(record_id, xmlTitle, xmlFileName, xml_data, datestamp)SELECT ''' + @record_id_aa + ''', ''' + @xmlTitle_aa + ''', ''' + @xmlFileName_aa + ''', xmlData, ''' + @datestamp + ''' FROM( SELECT * FROM OPENROWSET (BULK N''' + @xmlFileName_aa + ''' , SINGLE_BLOB) AS XMLDATA) AS FileImport (XMLDATA)INSERT INTO tblXMLFeeds(record_id, xmlTitle, xmlFileName, xml_data, datestamp)SELECT ''' + @record_id_bb + ''', ''' + @xmlTitle_bb + ''', ''' + @xmlFileName_bb + ''', xmlData, ''' + @datestamp + '''FROM( SELECT * FROM OPENROWSET (BULK N''' + @xmlFileName_bb + ''' , SINGLE_BLOB) AS XMLDATA) AS FileImport (XMLDATA)INSERT INTO tblXMLFeeds(record_id, xmlTitle, xmlFileName, xml_data, datestamp)SELECT ''' + @record_id_cc + ''', ''' + @xmlTitle_cc + ''', ''' + @xmlFileName_cc + ''', xmlData, ''' + @datestamp + '''FROM( SELECT * FROM OPENROWSET (BULK N''' + @xmlFileName_cc + ''' , SINGLE_BLOB) AS XMLDATA) AS FileImport (XMLDATA)')END
  3. Could you let me know how I can correct that? I moved the currentmsg variable just above the "setInterval", but that made no difference. Thanks for any help.
  4. Ok, here's an update:I received a suggestion of moving the following line out of the "if" statement, //Rotate msg and display it in DIV: document.getElementById("container").innerHTML = themessage;//applies entire message to div "container" themessage = ''; }//end if currentmsg = (currentmsg < msglength - 1)? currentmsg + 1 : 1; //(1 < 4 - 1)? 1 + 1 : 1; and it works! Yeah.But now I have another issue on this line: setInterval("rotatemsg()",tickerobj.childNodes[0].firstChild.nodeValue);//set ticker to "pause" node value ...within the init_ticker() function. Now the pause still happens for the nodes not displayed. So although it does display only the nodes that have a status="active" value, the "1000" pause value still happens for those blank nodes. If anyone has any suggestions on how I can tweak my code to fix that as well, that would be great. Thanks.
  5. I found an online tutorial on using JavaScript to load a news ticker from XML data. I now want to filter those results by displaying only "message" nodes that contain an "@status" attribute value of "active". I've made a few attempts at it without success. Below is the code that I have, including the solution I tried without success under "filter attempt". If anyone could help me to solve this issue, I'd really appreciate it. Thanks.xmlticker.xml: <?xml version="1.0" encoding="iso-8859-1"?><xmlticker> <pause>1000</pause> <message url="url1.html" status="active" description="Description #1">Message #1</message> <message url="url2.html" status="inactive" description="Description #2">Message #2</message> <message url="url3.html" status="active" description="Description #3">Message #3</message> <message url="url4.html" status="active" description="Description #4">Message #4</message></xmlticker> ticker.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><script language="javascript">/*DOM XML ticker- © Dynamic Drive (www.dynamicdrive.com)For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.comCredit MUST stay intact*///Declare variablesvar tickercontainer = '<div id="container" style="background-color:#FFFFE1;width:150px;height:120px;font:normal 13px Verdana;"></div>';//container for ticker. Modify its STYLE attribute to customize style.var xmlsource = "xmlticker.xml";//specifies path to xml filevar notWhitespace = /\S/; //regular expression used to match any non-whitespace charactervar msglength = "";var currentmsg = 1;var themessage = "";//load xml fileif (window.ActiveXObject) {//then var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");}else if (document.implementation && document.implementation.createDocument) {//then var xmlDoc= document.implementation.createDocument("","doc",null);}//end if if (typeof xmlDoc != "undefined") {//then //var nodelist As XmlNodeList; document.write(tickercontainer); xmlDoc.load(xmlsource);}//end iffunction init_ticker() {//begin function //Cache "messages" element of xml file tickerobj = xmlDoc.getElementsByTagName("xmlticker")[0];//ORIGINAL - WORKING //REMOVE white spaces in XML file. Intended mainly for NS6/Mozilla for (i=0;i<tickerobj.childNodes.length;i++) {//begin loop if ((tickerobj.childNodes[i].nodeType == 3) && (!notWhitespace.test(tickerobj.childNodes[i].nodeValue))) {//then tickerobj.removeChild(tickerobj.childNodes[i]); i--; }//end if }//end loop document.getElementById("container").innerHTML = "Information follows...";//tickerobj.childNodes[1].firstChild.nodeValue;//this is the container's first value msglength = tickerobj.childNodes.length;//amount of message nodes setInterval("rotatemsg()",tickerobj.childNodes[0].firstChild.nodeValue);//set ticker to "pause" node value}//end functionfunction rotatemsg() {//begin function var msgsobj = tickerobj.childNodes[currentmsg];//starting with message 1 (tickerobj.childNodes[1]) if (msgsobj.getAttribute("url") != null) {//then themessage = '<strong><a href="' + msgsobj.getAttribute("url") + '"'; //Set target if (msgsobj.getAttribute("target") != null); {//then themessage += ' target="' + msgsobj.getAttribute("target") + '"'; themessage += '>'; }//end if themessage += msgsobj.firstChild.nodeValue;//sets title themessage += '</a>: </strong>'; themessage += msgsobj.getAttribute("description"); themessage += ' <a href="' + msgsobj.getAttribute("url") + '">Learn more >></a>'; //Rotate msg and display it in DIV: document.getElementById("container").innerHTML = themessage;//applies entire message to div "container" currentmsg = (currentmsg < msglength - 1)? currentmsg + 1 : 1; //(1 < 4 - 1)? 1 + 1 : 1 themessage = ''; }//end if}//end functionfunction fetchxml() {//begin function if (xmlDoc.readyState == 4) {//then init_ticker(); } else { setTimeout("fetchxml()",10); }//end if}//end function</script><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Test File</title></head><body><script language="javascript">if (window.ActiveXObject) {//then fetchxml();}else if (typeof xmlDoc != "undefined") {//then xmlDoc.onload = init_ticker;}//end if</script></body></html> filter attempt: function rotatemsg() {//begin function var msgsobj = tickerobj.childNodes[currentmsg];//starting with message 1 (tickerobj.childNodes[1]) if (msgsobj.getAttribute("url") != null && msgsobj.getAttribute("status") != "inactive") {//then <<<<<------*****THIS IS WHAT I TRIED***** themessage = '<strong><a href="' + msgsobj.getAttribute("url") + '"'; //Set target if (msgsobj.getAttribute("target") != null); {//then themessage += ' target="' + msgsobj.getAttribute("target") + '"'; themessage += '>'; }//end if themessage += msgsobj.firstChild.nodeValue;//sets title themessage += '</a>: </strong>'; themessage += msgsobj.getAttribute("description"); themessage += ' <a href="' + msgsobj.getAttribute("url") + '">Learn more >></a>'; //Rotate msg and display it in DIV: document.getElementById("container").innerHTML = themessage;//applies entire message to div "container" currentmsg = (currentmsg < msglength - 1)? currentmsg + 1 : 1; //(1 < 4 - 1)? 1 + 1 : 1 themessage = ''; }//end if}//end function
  6. I was able to come up with a solution that works in 1.0, and here it is:<xsl:for-each select="root/name[not(text() = ../preceding-sibling::name/text())]">Another user noted that if I was using 2.0, I could use the distinct-values function. Just another reason why I need to upgrade soon. Anyway, thanks.
  7. Hello,I'm working on a for-each element that will display only one occurrence of a name node, even if there are several occurences of that name in the XML doc. Here's an example of what I need:XML doc:<root> <name>Janice Smith</name> <name>Janice Smith</name> <name>Michael Jones</name> <name>Michael Jones</name> <name>Michael Jones</name></root>XSLT FOR-EACH ELEMENT:<xsl:for-each select="root/name"><!-- <<<<---something is missing here --> <xsl:value-of select="." /><br /></xsl:for-each>WANTED RESULT:Janice SmithMichael JonesI'll continue to work on a possible solution until/if I hear get from someone else. Thanks for any help.
  8. Wow, that's great. I just got another solution from Michael Kay, and here it is for future note:<xsl:for-each select="$this_page/dayofweek/day"> <xsl:sort order="ascending" data-type="number" select="(@id - $current_weekday + 7) mod 7" /> <td><xsl:value-of select="." /></td> </xsl:for-each>Thanks SO much for your help!
  9. I need to loop through a set of nodes that contains the seven days of the week, like this:<dayofweek> <day id="0">Sunday</day> <day id="1">Monday</day> <day id="2">Tuesday</day> <day id="3">Wednesday</day> <day id="4">Thursday</day> <day id="5">Friday</day> <day id="6">Saturday</day></dayofweek>The "id" values match up with the current weekday value from VB.NET using the DateTime.DayOfWeek method, like this:0 = Sunday1 = Monday2 = Tuesday3 = Wednesday4 = Thursday5 = Friday6 = SaturdayOk, now I want to loop through the seven days of the week, starting with the current day, which is Monday (1) for this example. So here's what I've tried so far:<xsl:param name="current_weekday" select="1" /><!-- Monday --><xsl:for-each select="$this_page/dayofweek/day"> <xsl:sort order="descending" data-type="text" select="@id = $current_weekday" /> <xsl:value-of select="." /><br /></xsl:for-each>OUTPUT:MondaySunday <!-- WRONGTuesdayWednesdayThursdayFridaySaturdayI believe that this is because the sort is displaying the date that matches "1", but after that it sorts in the usual way. I cannot using proceeding-sibling and following-sibling, because I want it to look around to the beginning nodes on its own.This is the output that I'd want if today was Monday (1):MondayTuesdayWednesdayThursdayFridaySaturdaySundayDoes anyone know how to do this? I'd appreciate your help.
  10. I basically need to know how to pull selected radiobutton values from an ItemDataBound event into the RadioButton_CheckedChanged event.The radiobutton values are dynamically populated from an ItemDataBound event for three test records, which are located within a SQL Server 2000 database table. The two options are "Y" and "N". Each radiobutton already does have the following properties set: AutoPostBack=True, and OnCheckedChanged = "RadioButton_CheckedChanged". When each of the radiobuttons are changed, the RadioButton_CheckedChanged event does fire. But only static values can get inputted into the DB table. The values from the dynamic radiobuttons don't get passed from the ItemDataBound event to the RadioButton_CheckedChanged event.I've included my code below. If anyone can let me know what I'm doing wrong, that would be great. Thanks.Here's my code:form.aspx.vb Partial Class test_folder_Formprocedure_Formrequests Inherits System.Web.UI.Page Private ds As New DataSet() Dim sqlConn As SqlConnection Dim sqlCmd As SqlCommand Dim strConnection As String Private cmd1 As SqlDataAdapter = New SqlDataAdapter Private cmd2 As New SqlCommand() Dim strApproved As String = Nothing Dim strRecordID As String = Nothing Dim strUsername As String = Nothing 'Declare radiobuttons Dim rbApproveYes As RadioButton = Nothing Dim rbApproveNo As RadioButton = Nothing Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) Handles Me.Load 'Assign connection string strConnection = System.Configuration.ConfigurationManager.AppSettings("strConn") sqlConn = New SqlConnection(strConnection) 'Pull username Dim iPos strUsername = "SERVERNAME\USERNAME" iPos = Len(strUsername) - InStr(1, strUsername, "\", 1) strUsername = Right(strUsername, iPos) End Sub 'Bind Data to DataList Populating the Dataset Sub BindstrDbRecordID() cmd1 = New SqlDataAdapter("spFormRequests", sqlConn) 'Bind data cmd1.Fill(ds, "tblForm") dlForm.DataSource = ds dlForm.DataBind() End Sub 'The ItemDataBound Event Public Sub dlForm_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView) If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then 'Step 1: Assign label values strRecordID = drv.Row("RecordID").ToString Dim strFName As String = drv.Row("FName").ToString Dim strLName As String = drv.Row("LName").ToString Dim strOnBehalfOf As String = drv.Row("OnBehalfOf").ToString Dim strReason As String = drv.Row("Reason").ToString Dim strStartDate As String = drv.Row("StartDate").ToString Dim strEndDate As String = drv.Row("EndDate").ToString Dim strStartTime As String = drv.Row("StartTime").ToString Dim strEndTime As String = drv.Row("EndTime").ToString strApproved = drv.Row("Approved").ToString Dim strMgrID As String = drv.Row("MgrID").ToString Dim strMgrFName As String = drv.Row("MgrFName").ToString Dim strMgrLName As String = drv.Row("MgrLName").ToString Dim strMgrEmail As String = drv.Row("MgrEmail").ToString 'Assign requester's full name Dim strReqName As String = Nothing If strOnBehalfOf Is DBNull.Value Or strOnBehalfOf = "" Then 'If strOnBehalfOf Is Nothing Then strReqName = strFName & " " & strLName Else strReqName = strFName & " " & strLName & " (on behalf of " & strOnBehalfOf & ")" End If 'Assign full date(s) Dim strReqDates As String = Nothing If strEndDate Is DBNull.Value Or strEndDate = "" Then strReqDates = strStartDate Else strReqDates = strStartDate & " - " & strEndDate End If 'Assign full times Dim strReqTimes As String = strStartTime & " - " & strEndTime 'Assign email address for responders Dim hplMgr As HyperLink = DirectCast(e.Item.FindControl("hplMgr"), HyperLink) hplMgr.Text = strMgrFName & " " & strMgrLName hplMgr.NavigateUrl = "mailto:" & strMgrEmail & strRecordID rbApproveYes = CType(e.Item.FindControl("rbApproveYes"), RadioButton) rbApproveNo = CType(e.Item.FindControl("rbApproveNo"), RadioButton) 'Assign static radiobutton properties rbApproveYes.Text = "Y" rbApproveYes.GroupName = "rbApproved" rbApproveYes.AutoPostBack = True 'rbApproveYes.OnCheckedChanged = "rbApproved_CheckedChanged" rbApproveNo.Text = "N" rbApproveNo.GroupName = "rbApproved" rbApproveNo.AutoPostBack = True 'rbApproveNo.OnCheckedChanged = "rbApproved_CheckedChanged" 'Approved check: Dynamically populate radiobuttons with "Approved" value, like this: If strApproved = "Y" Then rbApproveYes.Checked = True End If If strApproved = "N" Then rbApproveNo.Checked = True End If 'Step 3: Assign label properties CType(e.Item.FindControl("lblRecordID"), Label).Text = strRecordID CType(e.Item.FindControl("lblReqName"), Label).Text = strReqName CType(e.Item.FindControl("lblReason"), Label).Text = strReason CType(e.Item.FindControl("lblReqDates"), Label).Text = strReqDates CType(e.Item.FindControl("lblReqTimes"), Label).Text = strReqTimes End If End Sub Public Sub RadioButton_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Dim rbApproveYes As RadioButton = DirectCast(sender, RadioButton) Dim rbApproveNo As RadioButton = DirectCast(sender, RadioButton) 'Pull form values from rbApprovedYes and rbApprovedNo Dim strApprovedValue As String = Nothing 'live If rbApproveYes.Checked Then strApprovedValue = "Y" ElseIf rbApproveNo.Checked Then strApprovedValue = "N" End If 'Assign date variables Dim dtCurrDate As DateTime = DateTime.Now 'Assign current date Dim strDateTimeISO As String = dtCurrDate.ToString("s") 'ISO format 'Insert into database cmd2 = New SqlCommand("spFormApproval", sqlConn) cmd2.CommandType = CommandType.StoredProcedure 'Assign form paramaters cmd2.Parameters.Add("@RecordID", SqlDbType.VarChar, 50).Value = "10" 'strRecordID cmd2.Parameters.Add("@Approved", SqlDbType.VarChar, 50).Value = strApprovedValue cmd2.Parameters.Add("@MgrID", SqlDbType.VarChar, 50).Value = strUsername cmd2.Parameters.Add("@datetime", SqlDbType.VarChar, 50).Value = strDateTimeISO 'Open connection sqlConn.Open() 'Execute query cmd2.ExecuteNonQuery() 'Close connection sqlConn.Close() 'End If End SubEnd Class form.aspx <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" EnableSessionState="true" EnableViewState="true" CodeFile="formrequests.aspx.vb" Inherits="test_folder_formprocedure_formrequests" title="Form Requests" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> Below is a list of stop work requests (starting with the most recent): <br /> <br /> <form name="FormRequests" runat="server"> <asp:DataList ID="dlForm" runat="server" OnItemDataBound="dlForm_ItemDataBound" RepeatLayout="Flow"> <ItemTemplate> <table class="tableborder_black" width="98%" id="Form Request #<%#DataBinder.Eval(Container, "DataItem.RecordID")%>"> <tr class="tablecell_black"> <th colspan="3">Form Request #<asp:Label runat="server" ID="lblRecordID"></asp:Label></th> </tr> <tr class="tablecell1" align="center"> <td align="center" width="50%">Requested By</td> <td align="center" width="25%">Status</td> <td align="center" width="25%">Responded By</td> </tr> <tr class="tablecell3" align="center"> <td> <asp:Label runat="server" id="lblReqName"></asp:Label> </td> <td> Approve?: <asp:RadioButton ID="rbApproveYes" OnCheckedChanged = "RadioButton_CheckedChanged" runat="server" /> <asp:RadioButton ID="rbApproveNo" OnCheckedChanged = "RadioButton_CheckedChanged" runat="server" /> </td> <td> <asp:HyperLink ID="hplMgr" runat="server" /> </td> </tr> <tr class="tablecell1"> <td align="center">Reason</td> <td align="center">Requested Date(s)</td> <td align="center">Requested Time(s)</td> </tr> <tr class="tablecell3" align="center"> <td align="center" valign="top"><asp:Label runat="server" ID="lblReason"></asp:Label></td> <td align="center"><asp:Label runat="server" ID="lblReqDates"></asp:Label></td> <td align="center"><asp:Label runat="server" ID="lblReqTimes"></asp:Label></td> </tr> <tr class="tablecell_black"> <td colspan="3" align="center"> <asp:HiddenField ID="hfRecordID" value='<%#DataBinder.Eval(Container, "DataItem.RecordID")%>' runat="server" /> <asp:Button ID="btnPrint" runat="server" Text="Print This Request" /> </td> </tr> </table> <br /><br /> </ItemTemplate> </asp:DataList> </form></asp:Content>
  11. I must say that this is the BEST reply that I've ever received:)But it's too bad that there doesn't seem to be a way to make this work properly. I received a suggestion to use <optgroup>, but the "Month" text wouldn't highlight in that case. This is kind of a pain.
  12. I have a form that collects the user's date of birth to compare against database data, and it works fine. But a blind user recently let me know that when his screen reader reads through each of the drop-down menus, they are one increment off on their number. I think this is because the first option has an empty value while the text has a value (example: "- Year -").So is there a way to get this working properly for a blind user, while still keeping the first option's value as empty? I've included the code for this file below. Any help would be greatly appreciated. Thanks.CODE: <label for="dob_month"></label><select id="dob_month" name="selectMonth" tabindex="1"> <option value="" selected>- Month -</option> <option value="01">January</option> <option value="02">February</option> <option value="03">March</option> <option value="04">April</option> <option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option></select><label for="dob_day"></label><select id="dob_day" name="selectDay" tabindex="2"> <option value="" selected="">- Select -</option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="04">04</option> <option value="05">05</option> <option value="06">06</option> <option value="07">07</option> <option value="08">08</option> <option value="09">09</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option></select><label for="dob_year">Year</label><select id="dob_year" name="selectYear" tabindex="3"> <option value="" selected="">- Select -</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <!-- ...and so on: DOB years go to the year 1900 --></select>
  13. Ok, got it. Here is the full solution (with help from another forum):Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) If Not Page.IsPostBack Then 'Disable submit button when VALID form is submitted btnSubmit.OnClientClick = "java script: Page_ClientValidate(); if (Page_IsValid) { " + btnSubmit.ClientID + ".style.visibility = 'hidden';" + btnSubmit.ClientID + ".style.display = 'none';" + btnSubmitDisabled.ClientID + ".style.visibility = 'visible';return true}" End If End SubThis needs to be placed before the btnSubmit_Click event. Thanks:)
  14. ...spoke too soon:I'm having an issue with this solution: I have required field and regular expression validators on my web form. If a user clicks the submit button when the form is invalid, the submit button is disabled and the user cannot correct their mistake. Could you give me an idea of how to solve this? I'm trying different solutions to this issue out without success so far. Thanks for any help.
  15. Before I received your response, I got referred to this article via the ASP.NET "web form" forum: http://dotnetchris.wordpress.com/2008/08/0...n-double-click/ ...and it worked great!!! Thanks for your help though:)
  16. I have a web form that collects basic data from a user (name, address, etc.), and then submits that data to a SQL Server 2000 table. It works great, except that some of those users click on the submit button multiple times, which submits duplicate entries into the database.So I'd like to disable the Submit button upon the button being clicked and the form being valid. I Google'd "OnClientClick Property with validation" (see http://www.google.com/search?client=firefo...=Google+Search), and tried several of their different suggestion without success. Here's what happens with each attempt:ATTEMPT #1 Add "this.disabled=true;" to submit button's OnClientClick property directly to the asp.net web form:regform.aspx.vb (#1): Partial Class regform Inherits System.Web.UI.Page Private ds As New DataSet() Dim sqlConn As SqlConnection Dim sqlCmd As SqlCommand Dim strConnection As String Private cmd As New SqlCommand() 'Here we declare the parameter which we have to use in our application Sub SubmitBtn_Click(ByVal Sender As Object, ByVal E As EventArgs) If Page.IsValid Then Try 'Jobs go there that send data to database Catch lblErrorMsg.Text = "There was a problem while submitting this form. Please contact the Webmaster at xxx-xxxx.</a>." End Try End If End SubEnd Class regform.aspx (#1): <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" EnableSessionState="true" EnableViewState="true" CodeFile="regform.aspx.vb" Inherits="regform" title="Registration Form" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <% If Not Page.IsPostBack Then%> <h2>Registration Form</h2> <br /> This form will allow for you to register online for class(es): <br /><br /> <form id="formReg" name="formReg" action="" method="post" runat="server"> <!-- ***Several form fields go here that include required field and regular expression validators -->*** <asp:Button ID="btnSubmit" Text="Submit" OnClick="SubmitBtn_Click" runat="server" OnClientClick="this.disabled=true;" /> </form> <% Else %> <asp:label id="lblErrorMsg" runat="server" /><br /> <% End If %> </asp:Content> #1 result:The submit button does get disabled once it's clicked, but the SubmitBtn_Click job doesn't fire at all.ATTEMPT #2 Add "java script:this.disabled=true;" to submit button's OnClientClick property via code file:regform.aspx.vb (#2): Partial Class regform Inherits System.Web.UI.Page Private ds As New DataSet() Dim sqlConn As SqlConnection Dim sqlCmd As SqlCommand Dim strConnection As String Private cmd As New SqlCommand() 'Here we declare the parameter which we have to use in our application Sub SubmitBtn_Click(ByVal Sender As Object, ByVal E As EventArgs) If Page.IsValid Then Try 'Disable button when form is submitted 'btnSubmit.Attributes.Add("OnClientClick", "this.disabled=true;") 'Jobs go there that send data to database Catch lblErrorMsg.Text = "There was a problem while submitting this form. Please contact the Webmaster at xxx-xxxx.</a>." End Try End If End SubEnd Class regform.aspx (#2): <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" EnableSessionState="true" EnableViewState="true" CodeFile="regform.aspx.vb" Inherits="regform" title="Registration Form" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <% If Not Page.IsPostBack Then%> <h2>Registration Form</h2> <br /> This form will allow for you to register online for class(es): <br /><br /> <form id="formReg" name="formReg" action="" method="post" runat="server"> <!-- ***Several form fields go here that include required field and regular expression validators -->*** <asp:Button ID="btnSubmit" Text="Submit" OnClick="SubmitBtn_Click" runat="server" /> </form> <% Else %> <asp:label id="lblErrorMsg" runat="server" /><br /> <% End If %> </asp:Content> #2 result:The web form goes through fine with the validation, but the button never gets disabled, and the form can be submitted multiple times.The submit button does get disabled once it's clicked, but the SubmitBtn_Click job doesn't fire at all.Using suggestions from the Google search results, I've also tried adding the following properties to the Page_Load and SubmitBtn_Click jobs within the code-file without success:btnSubmit.Attributes.Add("OnClientClick", "this.style.display='none';")btnSubmit.Enabled = FalsebtnSubmit.Attributes.Add("onclick", "this.disabled=true;")Me.btnSubmit.Attributes.Add("onclick", Me.Page.ClientScript.GetPostBackEventReference(btnSubmit, [string].Empty) + ";this.value='Please wait...';this.disabled = true;")btnSubmit.Attributes.Item("onclick") = "this.disabled=true;"btnSubmit.Attributes.Item("onclick") = "java script:document.formReg.btnSubmit.disabled =1;"btnSubmit.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(btnSubmit) & ";this.value='Please wait...';this.disabled = true;")If anyone could help me and/or point me in the right direction, I'd very much appreciate it. Thanks.
  17. Hi Jesh,Thanks for helping me to solve the problem. I figured out how to fix it the other day. I simply lowered the length of a few of the larger columns, and I was able to complete the rest of the data type adjustments.
  18. I'm trying to convert some of my table's field datatypes from text to varchar within SQL Server 2000 Enterprise Manager, and I was able to do some of them without a problem. But when I tried to finish the last of them, I received this error message:'tblTABLENAME' table- Unable to modify table. ODBC error: [Microsoft][ODBC SQL Server Driver] Cannot create a row of size 8810 which is greater than the allowable maximum of 8060.[Microsoft][ODBC SQL Server Driver][sql Server]The statement has been terminated.I did a count of the characters in the row that I attempted to convert, and the max char count is 2273. I was trying to change it to varchar(5000).Any ideas on how I can get this to work would be GREATLY appreciated. Thanks.
  19. I found a great tutorial on how to use the nested Repeater control to display hierarchical data using ASP.NET 2.0 and VB.NET at http://www.aspnettutorials.com/tutorials/c...epeater-vb.aspx. But it uses SELECT statements within the codefile, while I want to use stored procedures instead. So if someone could give me a basic example of how to modify its code using stored procedures instead, it would be greatly appreciated. I've included the code to reference that I've already created that uses stored procedures. Thanks.spElectionResultsCREATE PROCEDURE [dbo].[spElectionResults] ASSET NOCOUNT OFFSELECT ContestID, ContestTitleFROM tblElectionResultsWHERE (VoteFor <> '00')GROUP BY ContestID, ContestTitleHAVING (COUNT(ContestID) >= 1)ORDER BY ContestTitle ASC, ContestID ASCSET NOCOUNT ONGOcontests.aspx.vb 'Declare global variables Dim sqlConn As SqlConnection Dim strConnection As String Public dr As SqlDataReader 'Declare the parameters for stored procedures Private cmd_electionresults As New SqlCommand() Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) Dim ds As New DataSet 'Assign connection string strConnection = System.Configuration.ConfigurationManager.AppSettings("strConn") sqlConn = New SqlConnection(strConnection) 'Open DB connection sqlConn.Open() 'Declare variables Dim strContestID As String = Nothing, strContestTitle As String = Nothing 'Declare stored procedure cmd_electionresults = New SqlCommand("spElectionResults", sqlConn) cmd_electionresults.CommandType = CommandType.StoredProcedure 'Execute stored procedure and data reader cmd_electionresults.ExecuteNonQuery() dr = cmd_electionresults.ExecuteReader() While dr.Read() 'Assign variables from DB table strContestID = dr("ContestID").ToString() strContestTitle = dr("ContestTitle").ToString() 'Trim trailing whitespace from address variables strContestID = strContestID.Trim strContestTitle = strContestTitle.Trim 'Test variables 'Response.Write("strContestID: " & strContestID & "<br />") 'Response.Write("strContestTitle: " & strContestTitle & "<br />") 'Assign labels lblContestID.Text = strContestID lblContestTitle.Text = strContestTitle End While dr.Close() 'Close DB connection sqlConn.Close() End Sub
  20. I actually solved the problem by changing the semicolons ( to commas (,) that were separating the email addresses. Once I did that, it worked great. Thanks anyway:)
  21. I have a web form that pulls data entered by the user, and then sends out an email to the user and an email group based on the category selected by the user. The groups used for the categories are stored within an XML doc. I'm able to parse the XML doc without a problem. I know this because I assigned the email variable to a label on the page, and I can see the result after the form is submitted.But when I try to apply that same email address variable from that XML parse into the email job within the code file, I receive the following error:The specified string is not in the form required for an e-mail address.I've included my code below. If anyone could let me know what steps I'm missing, that would be great. Thanks.test.aspx <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" CodeFile="test.aspx.vb" Inherits="feedback_test" AutoEventWireup="true" title="Feedback Form - TEST" %><asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="server"> <% If Not Page.IsPostBack Then %> <form name="formFeedback" action="" method="post" runat="server"> <asp:ValidationSummary ID="valSummary" runat="server" HeaderText="You must fix the following form entries:" Font-Names="verdana" Font-Size="10pt" Font-Bold="True" /> <br /> <table class="tableborder_black" width="98%" id="Feedback Form"> <tbody> <tr class="tablecell_black"> <th scope="col" colspan="2">Feedback Form</th> </tr> <tr> <td class="tablecell1" align="right" valign="top">Category</td> <td class="tablecell3"> <asp:DropDownList id="selectCategory" runat="server"> <asp:ListItem Value="gen" Text="General" Selected="True" /> <asp:ListItem Value="cat1" Text="Category 1" /> <asp:ListItem Value="cat2" Text="Category 2" /> <asp:ListItem Value="cat3" Text="Category 3" /> </asp:DropDownList> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top">Email Address</td> <td class="tablecell3"><asp:Textbox id="txtEmailAddress" columns="20" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="txtEmailAddress" ErrorMessage="Email must be valid (Format: you@domain.com)." ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top" style="height: 50px">Comments</td> <td class="tablecell3" style="height: 50px"> <asp:TextBox ID="txtComments" Columns="40" Rows="4" runat="server" Height="60px" TextMode="MultiLine"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtComments" ErrorMessage="Must enter comments to complete this form." Display="Dynamic"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator8" runat="server" ControlToValidate="txtComments" ErrorMessage="Must enter between 5 and 1000 characters." ValidationExpression="^[a-zA-Z-0-9]{5,1000}$" Display="Dynamic"></asp:RegularExpressionValidator> </td> </tr> <tr class="tablecell_black"> <td scope="col" colspan="2" align="center"> <asp:HiddenField ID="hfDateTime" runat="server" /> <input id="btnReset" type="Reset" runat="server"> <asp:Button ID="btnSubmit" Text="Submit" OnClick="SubmitBtn_Click" runat="server" /> </td> </tr> </tbody> </table> </form> <br /><br /> <!-- Test variables --> <strong>lblContactsTitle: </strong><asp:label id="lblContactsTitle" runat="server" /><br /> <strong>lblContactsEmail: </strong><asp:label id="lblContactsEmail" runat="server" /><br /> <strong>lblCategory: </strong><asp:label id="lblCategory" runat="server" /><br /> <strong>lblEmailAddress: </strong><asp:label id="lblEmailAddress" runat="server" /><br /> <strong>lblComments: </strong><asp:label id="lblComments" runat="server" /><br /> <% Else %> <asp:label id="lblErrorMsg" runat="server" /><br /> <% End If %></asp:content> test.aspx.vb Partial Class feedback_test Inherits System.Web.UI.Page Dim strSiteDomain As String = "/mysite" Sub SubmitBtn_Click(ByVal Sender As Object, ByVal E As EventArgs) 'Declare form variables Dim category_form As String = selectCategory.SelectedItem.Value Dim email_form As String = txtEmailAddress.Text Dim comments_form As String = txtComments.Text 'Assign date variables Dim dtCurrDate As DateTime = DateTime.Now 'Assign current date Dim strDateTimeISO As String = dtCurrDate.ToString("s") 'ISO format hfDateTime.Value = strDateTimeISO 'Assign labels lblCategory.Text = category_form lblEmailAddress.Text = email_form lblComments.Text = comments_form If Page.IsValid Then Try 'Pull group members by selected category Dim objEmailGroup As Object = False Dim strXMLPath_contacts As String, strXSLPath_contacts As String strXMLPath_contacts = strSiteDomain & "/help/docs/xml/contacts.xml" 'xml doc strXSLPath_contacts = strSiteDomain & "/help/docs/xslt/contacts.xsl" 'xsl doc 'Load MainContent XML file internal_links.xml and assign page properties Dim strContactsTitle As String = Nothing, strContactsEmail As String = Nothing Dim contacts_xmld As XmlDocument Dim contacts_nodelist As XmlNodeList Dim xml_node As XmlNode 'Create the XML Document contacts_xmld = New XmlDocument() 'Load the Xml file contacts_xmld.Load(MapPath(strSiteDomain & "/help/docs/xml/contacts.xml")) 'Get the list of name nodes contacts_nodelist = contacts_xmld.SelectNodes("/contacts/dept_div[@id = '" & category_form & "']") 'Response.Write(contacts_nodelist) 'TEST 'Loop through the nodes For Each xml_node In contacts_nodelist 'Pull XML nodes strContactsTitle = xml_node.Item("title").InnerText strContactsEmail = xml_node.Item("email_contacts").InnerText lblContactsTitle.Text = strContactsTitle lblContactsEmail.Text = strContactsEmail Next 'end loop 'Email job to group members Dim mail_group As New System.Net.Mail.MailMessage(email_form, strContactsEmail, "Feedback Form", "<font face='arial' size='2'>The following feedback was submitted to your department:<br /><br/ ><strong>Category: </strong>" & category_form & "<br /><strong>Comments: </strong>" & comments_form & "</font>") Dim mail_user As New System.Net.Mail.MailMessage("webmaster@mysite.com", email_form, "Feedback Form", "<font face='arial' size='2'>Thank you for submitting feedback through our feedback form. If requested, someone from our staff will be in contact with you withing 2-3 business days.<br /><br />Webmaster</font>") Response.Write("objEmailGroup = True<br />") 'strContactsEmail 'email_form = user's email address mail_group.BodyEncoding = System.Text.Encoding.UTF8 mail_group.IsBodyHtml = True mail_user.BodyEncoding = System.Text.Encoding.UTF8 mail_user.IsBodyHtml = True Dim smtpUser As String = "USERNAME" Dim smtpPassword As String = "PASSWORD" Dim smtpServer As String = "EMAILSERVERNAME" Dim smtp As New Net.Mail.SmtpClient() With smtp If smtpUser.Length > 0 Then .Host = smtpServer .Port = 25 .Credentials = New System.Net.NetworkCredential(smtpUser, smtpPassword) End If End With 'Email job to group smtp.Send(mail_group) 'Email job to user for confirmation (if email is not empty) If email_form <> "" Then smtp.Send(mail_user) End If Catch lblErrorMsg.Text = "There was a problem while submitting this form. Please contact the <a href='mailto:webmaster@mysite.com'>Webmaster</a>." End Try End If End SubEnd Class
  22. kwilliams

    XSLT Loop?

    I have the following JavaScript loop within an old ASP page that loops through the years from a starting year variable (1900) to the ending year variable (1990): <%//Year arrayvar strCurrDate = new Date();strCurrYear = strCurrDate.getYear();strVotingYear = strCurrYear - 18;//youngest voter yearstrDiffYear = strVotingYear - 1900;//years from youngest minus oldest voters//Voter year loopvar LoopNumber = strDiffYear;for (i=1900;i<=strVotingYear;i++){ Response.Write(i + "<br />");//test Response.Write("<option value='" + i + "'>" + i + "</option>");//test}%> I'm wondering if I can do the same thing within XSLT with the use of a for:each method. I've been able to create the same variables with XSLT math, like this: <xsl:param name="current_year" select="''" /><xsl:param name="voting_year" select="$current_year - 18" /><!-- youngest voter year --><xsl:param name="diff_year" select="$voting_year - 1900" /><!-- years from youngest minus oldest voters --> And maybe the XSLT code could look like this? <select id="year" name="selectYear"> <option value="" selected="">- Year -</option> <xsl:for-each select=""> <!-- ???Not sure what to do here??? --> <option value="???"><xsl:value-of select="???" /></option> </xsl:for-each></select> Any help would be appreciated. Thanks.
  23. I was originally doing that exact solution, but I really want to learn how to handle all of these tasks on one page. Any suggestion on how to do that?
  24. I have an ASP.NET (2.0) input form that submits user data to a DB table using a stored procedure only after the ASP.NET validations have been met. Once the page is valid, the form disappears to the user, and they instead see a confirmation message.It works great, except for if I then push the refresh button on that same page. If I do that, the stored procedure is run again, and the data is re-submitted to the DB table.I know that I'm missing a simple step in this, but I'm not sure how to proceed. I've included all of the related code below. Any and all help would be appreciated.feedback.aspx.vb: Imports System.Data.SqlClientPartial Class forms_feedback Inherits System.Web.UI.Page Private ds As New DataSet() Private conn As SqlConnection Private cmd As New SqlCommand() Sub SubmitBtn_Click(ByVal Sender As Object, ByVal E As EventArgs) 'Declare form variables Dim category_form As String = selectCategory.SelectedItem.Value Dim address_form As String = txtAddress.Text Dim fullname_form As String = txtFullName.Text Dim city_form As String = txtCity.Text Dim state_form As String = selectState.SelectedItem.Value Dim zipcode_form As String = txtZipCode.Text Dim email_form As String = txtEmailAddress.Text Dim phone_form As String = txtPhone.Text Dim comments_form As String = txtComments.Text 'Assign date variables Dim dtCurrDate As DateTime = DateTime.Now 'Assign current date Dim strDateTimeISO As String = dtCurrDate.ToString("s") 'ISO format hfDateTime.Value = strDateTimeISO Session("SubmitTime") = dtCurrDate.ToString("t") 'Assign server variables hfRemoteAddr.Value = Request.ServerVariables("REMOTE_ADDR") hfRemoteHost.Value = Request.ServerVariables("REMOTE_HOST") If Page.IsValid Then 'Display confirmation message lblOutput.Text = "Thank you for completing the Feedback Form. If contact was requested, you should be contacted by someone within 1-3 days during normal business hours." 'Insert into database conn = New SqlConnection("server=SERVERNAME;database=DBNAME;uid=USERNAME;pwd=PASSWORD") cmd = New SqlCommand("spFeedback", conn) cmd.CommandType = CommandType.StoredProcedure 'Assign form paramaters cmd.Parameters.Add("@category_id", SqlDbType.VarChar, 16).Value = category_form cmd.Parameters.Add("@fullname", SqlDbType.VarChar, 50).Value = fullname_form cmd.Parameters.Add("@address", SqlDbType.VarChar, 50).Value = address_form cmd.Parameters.Add("@city", SqlDbType.VarChar, 50).Value = city_form cmd.Parameters.Add("@state", SqlDbType.VarChar, 2).Value = state_form cmd.Parameters.Add("@zipcode", SqlDbType.VarChar, 10).Value = zipcode_form cmd.Parameters.Add("@email", SqlDbType.VarChar, 75).Value = email_form cmd.Parameters.Add("@phone", SqlDbType.VarChar, 20).Value = phone_form cmd.Parameters.Add("@comments", SqlDbType.VarChar, 1000).Value = comments_form cmd.Parameters.Add("@remoteaddr", SqlDbType.VarChar, 20).Value = hfRemoteAddr.Value cmd.Parameters.Add("@remotehost", SqlDbType.VarChar, 20).Value = hfRemoteHost.Value cmd.Parameters.Add("@datetime", SqlDbType.VarChar, 50).Value = hfDateTime.Value conn.Open() cmd.ExecuteNonQuery() conn.Close() End If End SubEnd Class feedback.aspx: <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" CodeFile="feedback.aspx.vb" Inherits="forms_feedback" AutoEventWireup="true" title="Feedback Form" %><asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="server"> <asp:label id="lblOutput" runat="server" /><br /> <% If Not Page.IsPostBack Then %> <form name="formFeedback" action="" method="post" runat="server"> <asp:ValidationSummary ID="valSummary" runat="server" HeaderText="You must fix the following form entries:" Font-Names="verdana" Font-Size="10pt" Font-Bold="True" /> <br /> <table class="tableborder_black" width="98%" id="Feedback Form"> <tbody> <tr class="tablecell_black"> <th scope="col" colspan="2">Feedback Form</th> </tr> <tr> <td class="tablecell1" align="right" valign="top">Category</td> <td class="tablecell3"> <asp:DropDownList id="selectCategory" runat="server"> <asp:ListItem Value="general" Text="General" Selected="True" /> <asp:ListItem Value="cat1" Text="Category 1" /> <asp:ListItem Value="cat2" Text="Category 2" /> <asp:ListItem Value="cat3" Text="Category 3" /> </asp:DropDownList> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top" style="height: 26px">Full Name</td> <td class="tablecell3" style="height: 26px"> <asp:Textbox id="txtFullName" columns="20" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Allowed characters: A-Z, a-z, and dashes (-)." ValidationExpression="^[a-zA-Z-]{0,50}$" ControlToValidate="txtFullName"></asp:RegularExpressionValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top">Address</td> <td class="tablecell3"><asp:Textbox id="txtAddress" columns="20" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtAddress" ErrorMessage="Allowed characters: 0-9, A-Z, a-z, dashes (-), periods (.), and number signs (#)." ValidationExpression="^[a-zA-Z0-9 \.#-/]{0,50}$"></asp:RegularExpressionValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top">City</td> <td class="tablecell3"><asp:Textbox id="txtCity" columns="20" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtCity" ErrorMessage="Allowed characters: A-Z, a-z, dashes (-), and periods (.)." ValidationExpression="^[a-zA-Z \.-]{0,50}$"></asp:RegularExpressionValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top">State</td> <td class="tablecell3"> <!--<asp:DropDownList id="stateoption" runat="server" /> <br />--> <asp:DropDownList id="selectState" runat="server"> <asp:ListItem Value="" Text="- Select -" Selected="true" /> <asp:ListItem Value="AK" Text="Arkansas" /> <asp:ListItem Value="AL" Text="Alabama" /> <asp:ListItem Value="AR" Text="Arkansas" /> <asp:ListItem Value="AZ" Text="Arizona" /> <asp:ListItem Value="CA" Text="California" /> <asp:ListItem Value="CO" Text="Colorado" /> <asp:ListItem Value="CT" Text="Connecticut" /> <asp:ListItem Value="DE" Text="Deleware" /> <asp:ListItem Value="FL" Text="Florida" /> <asp:ListItem Value="GA" Text="Georgia" /> <asp:ListItem Value="HI" Text="Hawaii" /> <asp:ListItem Value="IA" Text="Iowa" /> <asp:ListItem Value="ID" Text="Idaho" /> <asp:ListItem Value="IL" Text="Illinois" /> <asp:ListItem Value="IN" Text="Indiana" /> <asp:ListItem Value="KS" Text="Kansas" /> <asp:ListItem Value="KY" Text="Kentucky" /> <asp:ListItem Value="LA" Text="Louisiana" /> <asp:ListItem Value="MA" Text="Massachusetts" /> <asp:ListItem Value="MD" Text="Maryland" /> <asp:ListItem Value="ME" Text="Maine" /> <asp:ListItem Value="MI" Text="Michigan" /> <asp:ListItem Value="MN" Text="Minnesota" /> <asp:ListItem Value="MO" Text="Missouri" /> <asp:ListItem Value="MS" Text="Mississippi" /> <asp:ListItem Value="MT" Text="Montana" /> <asp:ListItem Value="NC" Text="North Carolina" /> <asp:ListItem Value="ND" Text="North Dakota" /> <asp:ListItem Value="NE" Text="Nebraska" /> <asp:ListItem Value="NH" Text="New Hampshire" /> <asp:ListItem Value="NJ" Text="New Jersey" /> <asp:ListItem Value="NM" Text="New Mexico" /> <asp:ListItem Value="NV" Text="Nevada" /> <asp:ListItem Value="NY" Text="New York" /> <asp:ListItem Value="OH" Text="Ohio" /> <asp:ListItem Value="OK" Text="Oklahoma" /> <asp:ListItem Value="OR" Text="Oregon" /> <asp:ListItem Value="PA" Text="Pennsylvania" /> <asp:ListItem Value="RI" Text="Rhode Island" /> <asp:ListItem Value="SC" Text="South Carolina" /> <asp:ListItem Value="SD" Text="South Dakota" /> <asp:ListItem Value="TN" Text="Tennessee" /> <asp:ListItem Value="TX" Text="Texas" /> <asp:ListItem Value="UT" Text="Utah" /> <asp:ListItem Value="VA" Text="Virginia" /> <asp:ListItem Value="VT" Text="Vermont" /> <asp:ListItem Value="WA" Text="Washington" /> <asp:ListItem Value="DC" Text="Washington D.C." /> <asp:ListItem Value="WI" Text="Wisconsin" /> <asp:ListItem Value="WV" Text="West Virginia" /> <asp:ListItem Value="WY" Text="Wyoming" /> <asp:ListItem Value="OT" Text="Other (specify in comments)" /> </asp:DropDownList> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="selectState" runat="server" ErrorMessage="Must select a state."></asp:RequiredFieldValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top" style="height: 26px">Zip Code</td> <td class="tablecell3" style="height: 26px"><asp:Textbox id="txtZipCode" columns="20" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtZipCode" ErrorMessage="Zip code must be valid (Format: xxxxx or xxxxx-xxxx)." ValidationExpression="\d{5}(-\d{4})?"></asp:RegularExpressionValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top">Email Address</td> <td class="tablecell3"><asp:Textbox id="txtEmailAddress" columns="20" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="txtEmailAddress" ErrorMessage="Email must be valid (Format: you@domain.com)." ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top">Phone</td> <td class="tablecell3"><asp:Textbox id="txtPhone" columns="20" runat="server" /> <asp:RegularExpressionValidator ID="RegularExpressionValidator7" runat="server" ControlToValidate="txtPhone" ErrorMessage="Phone number must be valid (Format: xxx-xxx-xxxx)." ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"></asp:RegularExpressionValidator> </td> </tr> <tr> <td class="tablecell1" align="right" valign="top" style="height: 50px">Comments</td> <td class="tablecell3" style="height: 50px"> <asp:TextBox ID="txtComments" Columns="40" Rows="4" runat="server" Height="60px" TextMode="MultiLine"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtComments" ErrorMessage="Must enter comments to complete this form." Display="Dynamic"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator8" runat="server" ControlToValidate="txtComments" ErrorMessage="Must enter between 5 and 1000 characters." ValidationExpression="^[a-zA-Z-0-9]{5,1000}$" Display="Dynamic"></asp:RegularExpressionValidator> </td> </tr> <tr class="tablecell_black"> <td scope="col" colspan="2" align="center"> <asp:HiddenField ID="hfRemoteAddr" runat="server" /> <asp:HiddenField ID="hfRemoteHost" runat="server" /> <asp:HiddenField ID="hfDateTime" runat="server" /> <input id="btnReset" type="Reset" runat="server"> <asp:Button ID="btnSubmit" Text="Submit" OnClick="SubmitBtn_Click" runat="server" /> </td> </tr> </tbody> </table> </form> <% End If %> </asp:content>
  25. I'm trying to validate my new site, and I'm running into a problem. I've declared the Transitional XHTML v1.1 DTD for my site, like this:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...but when I try to validate my site (http://www.douglas-county.com/) using the W3 XHTML validator, I receive errors stating that I cannot use width, height, and event alt attributes within an image tag. I already understand that some of the errors are things that I need to fix, but I'm not sure what's going on with the others mentioned. Here's the path to the validator's results: http://validator.w3.org/check?uri=http%3A%...ine&group=0Why is this happening? Everything I read (like http://www.blackwidows.co.uk/resources/tut...comparison.php) states that those attributes are in fact accepted in XHTML 1.1 Transitional, so I'm thoroughly confused. Thanks for any input.
×
×
  • Create New...