Solved

Critical: How to change the border color of asp.net dropdownlist using javascript?

Posted on 2013-01-09
14
1,351 Views
Last Modified: 2013-01-09
Hi,

I have asp.net dropdownlist and on button click in javascript, I am checking if dropdown is not having any selection, then it will change the border color to Red.

I am able to succesfully change the background color , but not the border color. below code is working fine if I am run the website locally.

<asp:DropDownList ID="PublishTime"  Height="18px" Width="80px"
 runat="server"  >
<asp:ListItem></asp:ListItem>
<asp:ListItem>01:00 AM</asp:ListItem>
<asp:ListItem>02:00 AM</asp:ListItem>
<asp:ListItem>03:00 AM</asp:ListItem>
<asp:ListItem>04:00 AM</asp:ListItem>
<asp:ListItem>05:00 AM</asp:ListItem>
<asp:ListItem>06:00 AM</asp:ListItem>
<asp:ListItem>07:00 AM</asp:ListItem>
<asp:ListItem>08:00 AM</asp:ListItem>
<asp:ListItem>09:00 AM</asp:ListItem>
<asp:ListItem>10:00 AM</asp:ListItem>
<asp:ListItem>11:00 AM</asp:ListItem>
<asp:ListItem>12:00 PM</asp:ListItem>
<asp:ListItem>01:00 PM</asp:ListItem>
<asp:ListItem>02:00 PM</asp:ListItem>
<asp:ListItem>03:00 PM</asp:ListItem>
<asp:ListItem>04:00 PM</asp:ListItem>
<asp:ListItem>05:00 PM</asp:ListItem>
<asp:ListItem>06:00 PM</asp:ListItem>
<asp:ListItem>07:00 PM</asp:ListItem>
<asp:ListItem>08:00 PM</asp:ListItem>
<asp:ListItem>09:00 PM</asp:ListItem>
<asp:ListItem>10:00 PM</asp:ListItem>
<asp:ListItem>11:00 PM</asp:ListItem>
<asp:ListItem>12:00 AM</asp:ListItem>
</asp:DropDownList>

<asp:Button ID="btnInsert"  runat="server" OnClientClick="return !formvalidation(this);"/>

javascript
<script>
function formvalidation() 
    {
       argElementTime = document.frmInsertScript.InsertScriptFormView_PublishTime;
                      
               if (argElementTime.value == "") 
                    { 
                        argElementTime.style.backgroundColor='#FFEEEE';
                        argElementTime.style.borderColor='#FF0000';
                         return true;
                    }    
                else
                    {
                        argElementTime.style.backgroundColor='#ffffff';
                        argElementTime.style.borderColor='#cccccc';
                    }
                
             return false;
}

Open in new window

0
Comment
Question by:Saroj13
  • 9
  • 5
14 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 38761272
Work fine for me :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script>

        $(document).ready(function () {
            $("form").submit(function (evt) {
                var notValid = false;
                if ($("#<%= PublishTime.ClientID %>").val() == "") {
                    notValid = true;
                    $("#<%= PublishTime.ClientID %>").css({ backgroundColor: "yellow", borderColor: "red" });
                }
                else {
                    $("#<%= PublishTime.ClientID %>").css({ backgroundColor: "white", borderColor: "#CCC" });
                }
                if (notValid) evt.preventDefault();
            })
        })

        </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="PublishTime"  Height="18px" Width="80px" runat="server" >
        <asp:ListItem></asp:ListItem>
            <asp:ListItem>01:00 AM</asp:ListItem>
            <asp:ListItem>02:00 AM</asp:ListItem>
            <asp:ListItem>03:00 AM</asp:ListItem>
            <asp:ListItem>04:00 AM</asp:ListItem>
            <asp:ListItem>05:00 AM</asp:ListItem>
            <asp:ListItem>06:00 AM</asp:ListItem>
            <asp:ListItem>07:00 AM</asp:ListItem>
            <asp:ListItem>08:00 AM</asp:ListItem>
            <asp:ListItem>09:00 AM</asp:ListItem>
            <asp:ListItem>10:00 AM</asp:ListItem>
            <asp:ListItem>11:00 AM</asp:ListItem>
            <asp:ListItem>12:00 PM</asp:ListItem>
            <asp:ListItem>01:00 PM</asp:ListItem>
            <asp:ListItem>02:00 PM</asp:ListItem>
            <asp:ListItem>03:00 PM</asp:ListItem>
            <asp:ListItem>04:00 PM</asp:ListItem>
            <asp:ListItem>05:00 PM</asp:ListItem>
            <asp:ListItem>06:00 PM</asp:ListItem>
            <asp:ListItem>07:00 PM</asp:ListItem>
            <asp:ListItem>08:00 PM</asp:ListItem>
            <asp:ListItem>09:00 PM</asp:ListItem>
            <asp:ListItem>10:00 PM</asp:ListItem>
            <asp:ListItem>11:00 PM</asp:ListItem>
            <asp:ListItem>12:00 AM</asp:ListItem>
        </asp:DropDownList>
        <asp:Button ID="btnInsert" runat="server" Text="TEST FORM" />
    </div>
    </form>
</body>
</html>

Open in new window

0
 

Author Comment

by:Saroj13
ID: 38761511
Its not working for me. dropdownlist is inside formview inside form.

Here is my code:

 $(document).ready(function () {
            $("form").submit(function (evt) {
                var notValid = false;
                if ($('<%= InsertScriptFormView.FindControl("PublishTime")%>').val() == "") {
                    notValid = true;
                    $('<%= InsertScriptFormView.FindControl("PublishTime")%>').css({ backgroundColor: "yellow", borderColor: "red" });
                }
                else {
                    $('<%= InsertScriptFormView.FindControl("PublishTime")%>').css({ backgroundColor: "white", borderColor: "#CCC" });
                }
                if (notValid) evt.preventDefault();
            })
        })
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38761522
Why did you removed the sharp and .ClientID ?
 
$(document).ready(function () {
            $("form").submit(function (evt) {
                var notValid = false;
                if ($('#<%= InsertScriptFormView.FindControl("PublishTime").ClientID%>').val() == "") {
                    notValid = true;
                    $('#<%= InsertScriptFormView.FindControl("PublishTime").ClientID%>').css({ backgroundColor: "yellow", borderColor: "red" });
                }
                else {
                    $('#<%= InsertScriptFormView.FindControl("PublishTime").ClientID%>').css({ backgroundColor: "white", borderColor: "#CCC" });
                }
                if (notValid) evt.preventDefault();
            })
        })
0
 

Author Comment

by:Saroj13
ID: 38761531
I tried this  . i put in the head block and I am getting the following error:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38761537
could you right click on your page, choose view source and post it here?
0
 

Author Comment

by:Saroj13
ID: 38761553
<html>
    <head>
        <title>The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title>
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Lucida Console";font-size: .9em}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>
 
    <body bgcolor="white">
 
            <span><H1>Server Error in '/- Copy (4)' Application.<hr width=100% size=1 color=silver></H1>
 
            <h2> <i>The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</i> </h2></span>
 
            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
 
            <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
            <br><br>
 
            <b> Exception Details: </b>System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).<br><br>
 
            <b>Source Error:</b> <br><br>
 
            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code>
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
 
                  </td>
               </tr>
            </table>
 
            <br>
 
            <b>Stack Trace:</b> <br><br>
 
            <table width=100% bgcolor="#ffffcc">
               <tr>
                  <td>
                      <code><pre>
 
[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).]
   System.Web.UI.ControlCollection.Add(Control child) +11415588
   AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) in d:\E\AjaxControlToolkit_AjaxTk\Release\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs:300
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
</pre></code>
 
                  </td>
               </tr>
            </table>
 
            <br>
 
            <hr width=100% size=1 color=silver>
 
            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
 
            </font>
 
    </body>
</html>
<!--
[HttpException]: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).
   at System.Web.UI.ControlCollection.Add(Control child)
   at AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) in d:\E\AjaxControlToolkit_AjaxTk\Release\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs:line 300
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
[HttpUnhandledException]: Exception of type &#39;System.Web.HttpUnhandledException&#39; was thrown.
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.admin_insertscript_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\)\3e42e934\9ce41385\App_Web_raw52xmh.2.cs:line 0
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--><!--
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using &lt;customErrors mode="Off"/&gt;. Consider using &lt;customErrors mode="On"/&gt; or &lt;customErrors mode="RemoteOnly"/&gt; in production environments.-->
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38761558
thanks, for your next posts, the code snippet is your friend :)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 82

Expert Comment

by:leakim971
ID: 38761562
remove the javascript to remove any error and let your page correct with your control inside...
0
 

Author Comment

by:Saroj13
ID: 38761572
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head id="Head1"><title>
 
   <script type="text/javascript">
     
   function formvalidation()
    {
 argElementTime = document.frmInsertScript.InsertScriptFormView_PublishTime;
            if ( argElementTime.value == "")
                   
                        argElementTime.style.backgroundColor='#FFEEEE';
                        argElementTime.style.borderColor='#FF0000';
                         return true;
                    }    
                else
                    {
argElementTime.style.backgroundColor='#ffffff';
                        argElementTime.style.borderColor='#cccccc';
                    }
               
return false;
}//IsValidateFields
 
       
    </script>
 
</head>    
   
<body>
<form name="frmInsertScript" method="post" onsubmit="javascript:return WebForm_OnSubmit();" id="frmInsertScript">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTMxNzk5OTA0NQ9kFgICCA9kFgICAQ88KwAKAQAPFgQeC18hRGF0YUJvdW5kZx4LXyFJdGVtQ291bnRmZBYCZg9kFgZmDw8WAh4HVmlzaWJsZWhkZAIBD2QWAmYPZBYOAgUPZBYCAgEPEA8WAh8AZ2QPFgMCAQICAgMWAxAFCFJlcXVpcmVkBQEyZxAFCVN1Z2dlc3RlZAUBM2cQBQhWZXJiYXRpbQUBMWdkZAINDw8WAh4HRW5hYmxlZGhkZAIRD2QWAgIBDxAPFgQfAGcfA2hkZBYBZmQCFQ9kFgICAQ8QDxYCHwBnZBAVAwtGdWxmaWxsbWVudA1TYWxlcyBFeHByZXNzA1NWUBUDATMBMQEyFCsDA2dnZ2RkAhcPZBYCAgEPEA8WAh8AZ2QQFQIKSW5kaXZpZHVhbAVKb2ludBUCATEBMhQrAwJnZ2RkAjMPFgRkZGRlZAI1DxYEZGRkZWQCAg8PFgIfAmhkZBgCBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WDAUmSW5zZXJ0U2NyaXB0Rm9ybVZpZXckcmJsU2NyaXB0UmVsZWFzZVkFJkluc2VydFNjcmlwdEZvcm1WaWV3JHJibFNjcmlwdFJlbGVhc2VOBSBJbnNlcnRTY3JpcHRGb3JtVmlldyRjYmxTeXN0ZW0kMAUgSW5zZXJ0U2NyaXB0Rm9ybVZpZXckY2JsU3lzdGVtJDEFIEluc2VydFNjcmlwdEZvcm1WaWV3JGNibFN5c3RlbSQyBSBJbnNlcnRTY3JpcHRGb3JtVmlldyRjYmxTeXN0ZW0kMgUqSW5zZXJ0U2NyaXB0Rm9ybVZpZXckY2JsQXBwbGljYXRpb25UeXBlcyQwBSpJbnNlcnRTY3JpcHRGb3JtVmlldyRjYmxBcHBsaWNhdGlvblR5cGVzJDEFKkluc2VydFNjcmlwdEZvcm1WaWV3JGNibEFwcGxpY2F0aW9uVHlwZXMkMQUiSW5zZXJ0U2NyaXB0Rm9ybVZpZXckaXNOZXdDdXN0b21lcgUhSW5zZXJ0U2NyaXB0Rm9ybVZpZXckaXNEb05vdFNoYXJlBSNJbnNlcnRTY3JpcHRGb3JtVmlldyRpc0RvTm90U29saWNpdAUUSW5zZXJ0U2NyaXB0Rm9ybVZpZXcPFCsAB2RkAgJkZBYAZGRE8jCGP5yMhLmPPkxf5Hcho/Swne4NclDl7xx0iAD3Ug==" />
</div>
 
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['frmInsertScript'];
if (!theForm) {
    theForm = document.frmInsertScript;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
 
 
<script src="/Test - Copy (4)/WebResource.axd?d=rOzNHqGPBh8I9eCafxKGjj6FAO2UUQfBUJN-LNrbP3AMuJn3P190YnZDXOj49LeWKJEVzK9bkDf4HEAZ3qxW--drU2KW_o0I8c3G8dMIllo1&amp;t=634763319901984389" type="text/javascript"></script>
 
 
<script src="/Test - Copy (4)/ScriptResource.axd?d=JaduAKYXt7o4Eue2TXe4vk4SZp78cb_MXjbxqK0fiNi2VwQJVX3yw2PJ3M5D14suytJOXBCbXPMDIln3aNodIxRFLCwO6o1uJ-ocRg9uELTzDkPYmk7QFstjourUsje2vAowLQvitTvXD6OOqblE1pg-KZbwhO4yvzwUzIhmW4o1&amp;t=68c4b60a" type="text/javascript"></script>
<script src="sTest - Copy (4)/ScriptResource.axd?d=XOxhgXBYcjVhtpOsjGs5bN5Cw8-EoP66_CKdV4hM2Hpt9aAodnYdg11mPX8RyTNB7Q_Me72Q6KIrAwHA1CLIW2tdwkQ9R7FBtVdVBy3WajHuRtSEe_FwH-HFKvKWwFqiXrXCf1377ZoABvrAREeQfjWecYt7V4mpbIve_7JmkNaztXuaL_G87UzlacfK0cF50&amp;t=ffffffff940d030f" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//]]>
</script>
 
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
 
<div>
 
      <input type="hidden" name="__PREVIOUSPAGE" id="__PREVIOUSPAGE" value="GXX-UQ2W1eCsTVKroS5FVXx7fQlFALDaasb-T7GcYcLnEKvN6VktV7357VljHJTTf_FOMT3gicKe-fIgqoXzooyIExYzaEvd68bUQITDj47sz_zXRIq298DckSGj8P3UjI65xCnbCH16_WstEdXdAw2" />
      <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWNAKStNmUDAK319PMCwK41MzLDgK2u+alAgK1u+alAgK3u+alAgLd4OaiCwKV1paJBwKx8cKsCgKu5ZCVBAL5tcuTDAL5tceSDAL5tcORDAL5td+QDAL5tduXDAL5tdeWDAL5tdOVDAL5te+EDAL5teubDALYtc+cDALYtcuTDAKlnobTBALCn4rQBALCn4bTBALCn4LWBALCn57RBALCn5rUBALCn5bXBALCn5KqBALCn67FBALCn6rYBAKlno7dBAKlnorQBALYtceSDALvsO/EAgKZ64srApnrn4YJApnr4/QOAoqF7+MCAoqF8+MCAq7P8tkDAs6Rq1ICp4qUrgICnOak+wQCsqT+kAcC0siLkwwC2dmnqwwCg9LDhwECsvu+/g0CsZvCog8Cjcmqxw0CzZuNqA1hOZ5NMlIzFUJwRrZUOhQFHqBu/nSV8OL4ACAbFvgMuQ==" />
</div>
 

   
 
   <div id="body">
    <div class="PageTitle" > Script</div>
   
    <table cellspacing="0" border="0" id="InsertScriptFormView" style="background-color:White;border-collapse:collapse;">
      <tr valign="top">
            <td colspan="2">
 
        <table  width="100%">  
<tr>
<td align="center">
</td>
</tr>
<tr>
<td valign="top">
<select name="InsertScriptFormView$PublishTime" id="InsertScriptFormView_PublishTime" disabled="disabled" class="Dropdown-Admin-req" style="border-width:1pt;border-style:Solid;height:18px;width:80px;">
                  <option selected="selected" value=""></option>
                  <option value="01:00 AM">01:00 AM</option>
                  <option value="02:00 AM">02:00 AM</option>
                  <option value="03:00 AM">03:00 AM</option>
                  <option value="04:00 AM">04:00 AM</option>
                  <option value="05:00 AM">05:00 AM</option>
                  <option value="06:00 AM">06:00 AM</option>
                  <option value="07:00 AM">07:00 AM</option>
                  <option value="08:00 AM">08:00 AM</option>
                  <option value="09:00 AM">09:00 AM</option>
                  <option value="10:00 AM">10:00 AM</option>
                  <option value="11:00 AM">11:00 AM</option>
                  <option value="12:00 PM">12:00 PM</option>
                  <option value="01:00 PM">01:00 PM</option>
                  <option value="02:00 PM">02:00 PM</option>
                  <option value="03:00 PM">03:00 PM</option>
                  <option value="04:00 PM">04:00 PM</option>
                  <option value="05:00 PM">05:00 PM</option>
                  <option value="06:00 PM">06:00 PM</option>
                  <option value="07:00 PM">07:00 PM</option>
                  <option value="08:00 PM">08:00 PM</option>
                  <option value="09:00 PM">09:00 PM</option>
                  <option value="10:00 PM">10:00 PM</option>
                  <option value="11:00 PM">11:00 PM</option>
                  <option value="12:00 AM">12:00 AM</option>
 
            </select>
</formview>
</form>
 
 
<link rel="Stylesheet" media="screen" type="text/css" href="/WFALGScriptsTest - Copy (4)/Styles/AdminStyle.css" />
 
<div id="footer"><i>Wells Fargo Advisors Lending Group. Internal use only.</i>
 <img src="../images/vl-together-well-go-far.gif"
        id="footerImage" width="180" height="62" />
</div>
</div>    
            
</body>
</html>
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38761580
thanks, for your next posts, the code snippet is your friend :)
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38761587
$(document).ready(function () {
            $("form").submit(function (evt) {
                var notValid = false;
                if ($('#InsertScriptFormView_PublishTime').val() == "") {
                    notValid = true;
                    $('#InsertScriptFormView_PublishTime').css({ backgroundColor: "yellow", borderColor: "red" });
                }
                else {
                    $('#InsertScriptFormView_PublishTime').css({ backgroundColor: "white", borderColor: "#CCC" });
                }
                if (notValid) evt.preventDefault();
            })
        })

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 38761599
0
 

Author Comment

by:Saroj13
ID: 38761668
Its not working.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head id="Head1"><title>
 
   <script type="text/javascript">
     
   function formvalidation() 
    {
 argElementTime = document.frmInsertScript.InsertScriptFormView_PublishTime;
            if ( argElementTime.value == "") 
                    
                        argElementTime.style.backgroundColor='#FFEEEE';
                        argElementTime.style.borderColor='#FF0000';
                         return true;
                    }    
                else
                    {
argElementTime.style.backgroundColor='#ffffff';
                        argElementTime.style.borderColor='#cccccc';
                    }
                
return false;
}//IsValidateFields
 
       
    </script>
 
</head>    
   
<body>
<form name="frmInsertScript" method="post" onsubmit="javascript:return WebForm_OnSubmit();" id="frmInsertScript">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTMxNzk5OTA0NQ9kFgICCA9kFgICAQ88KwAKAQAPFgQeC18hRGF0YUJvdW5kZx4LXyFJdGVtQ291bnRmZBYCZg9kFgZmDw8WAh4HVmlzaWJsZWhkZAIBD2QWAmYPZBYOAgUPZBYCAgEPEA8WAh8AZ2QPFgMCAQICAgMWAxAFCFJlcXVpcmVkBQEyZxAFCVN1Z2dlc3RlZAUBM2cQBQhWZXJiYXRpbQUBMWdkZAINDw8WAh4HRW5hYmxlZGhkZAIRD2QWAgIBDxAPFgQfAGcfA2hkZBYBZmQCFQ9kFgICAQ8QDxYCHwBnZBAVAwtGdWxmaWxsbWVudA1TYWxlcyBFeHByZXNzA1NWUBUDATMBMQEyFCsDA2dnZ2RkAhcPZBYCAgEPEA8WAh8AZ2QQFQIKSW5kaXZpZHVhbAVKb2ludBUCATEBMhQrAwJnZ2RkAjMPFgRkZGRlZAI1DxYEZGRkZWQCAg8PFgIfAmhkZBgCBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WDAUmSW5zZXJ0U2NyaXB0Rm9ybVZpZXckcmJsU2NyaXB0UmVsZWFzZVkFJkluc2VydFNjcmlwdEZvcm1WaWV3JHJibFNjcmlwdFJlbGVhc2VOBSBJbnNlcnRTY3JpcHRGb3JtVmlldyRjYmxTeXN0ZW0kMAUgSW5zZXJ0U2NyaXB0Rm9ybVZpZXckY2JsU3lzdGVtJDEFIEluc2VydFNjcmlwdEZvcm1WaWV3JGNibFN5c3RlbSQyBSBJbnNlcnRTY3JpcHRGb3JtVmlldyRjYmxTeXN0ZW0kMgUqSW5zZXJ0U2NyaXB0Rm9ybVZpZXckY2JsQXBwbGljYXRpb25UeXBlcyQwBSpJbnNlcnRTY3JpcHRGb3JtVmlldyRjYmxBcHBsaWNhdGlvblR5cGVzJDEFKkluc2VydFNjcmlwdEZvcm1WaWV3JGNibEFwcGxpY2F0aW9uVHlwZXMkMQUiSW5zZXJ0U2NyaXB0Rm9ybVZpZXckaXNOZXdDdXN0b21lcgUhSW5zZXJ0U2NyaXB0Rm9ybVZpZXckaXNEb05vdFNoYXJlBSNJbnNlcnRTY3JpcHRGb3JtVmlldyRpc0RvTm90U29saWNpdAUUSW5zZXJ0U2NyaXB0Rm9ybVZpZXcPFCsAB2RkAgJkZBYAZGRE8jCGP5yMhLmPPkxf5Hcho/Swne4NclDl7xx0iAD3Ug==" />
</div>
 
<script type="text/javascript"> 
//<![CDATA[
var theForm = document.forms['frmInsertScript'];
if (!theForm) {
    theForm = document.frmInsertScript;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
 
 
<script src="/Test - Copy (4)/WebResource.axd?d=rOzNHqGPBh8I9eCafxKGjj6FAO2UUQfBUJN-LNrbP3AMuJn3P190YnZDXOj49LeWKJEVzK9bkDf4HEAZ3qxW--drU2KW_o0I8c3G8dMIllo1&amp;t=634763319901984389" type="text/javascript"></script>
 
 
<script src="/Test - Copy (4)/ScriptResource.axd?d=JaduAKYXt7o4Eue2TXe4vk4SZp78cb_MXjbxqK0fiNi2VwQJVX3yw2PJ3M5D14suytJOXBCbXPMDIln3aNodIxRFLCwO6o1uJ-ocRg9uELTzDkPYmk7QFstjourUsje2vAowLQvitTvXD6OOqblE1pg-KZbwhO4yvzwUzIhmW4o1&amp;t=68c4b60a" type="text/javascript"></script>
<script src="sTest - Copy (4)/ScriptResource.axd?d=XOxhgXBYcjVhtpOsjGs5bN5Cw8-EoP66_CKdV4hM2Hpt9aAodnYdg11mPX8RyTNB7Q_Me72Q6KIrAwHA1CLIW2tdwkQ9R7FBtVdVBy3WajHuRtSEe_FwH-HFKvKWwFqiXrXCf1377ZoABvrAREeQfjWecYt7V4mpbIve_7JmkNaztXuaL_G87UzlacfK0cF50&amp;t=ffffffff940d030f" type="text/javascript"></script>
<script type="text/javascript"> 
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//]]>
</script>
 
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
 
<div>
 
      <input type="hidden" name="__PREVIOUSPAGE" id="__PREVIOUSPAGE" value="GXX-UQ2W1eCsTVKroS5FVXx7fQlFALDaasb-T7GcYcLnEKvN6VktV7357VljHJTTf_FOMT3gicKe-fIgqoXzooyIExYzaEvd68bUQITDj47sz_zXRIq298DckSGj8P3UjI65xCnbCH16_WstEdXdAw2" />
      <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWNAKStNmUDAK319PMCwK41MzLDgK2u+alAgK1u+alAgK3u+alAgLd4OaiCwKV1paJBwKx8cKsCgKu5ZCVBAL5tcuTDAL5tceSDAL5tcORDAL5td+QDAL5tduXDAL5tdeWDAL5tdOVDAL5te+EDAL5teubDALYtc+cDALYtcuTDAKlnobTBALCn4rQBALCn4bTBALCn4LWBALCn57RBALCn5rUBALCn5bXBALCn5KqBALCn67FBALCn6rYBAKlno7dBAKlnorQBALYtceSDALvsO/EAgKZ64srApnrn4YJApnr4/QOAoqF7+MCAoqF8+MCAq7P8tkDAs6Rq1ICp4qUrgICnOak+wQCsqT+kAcC0siLkwwC2dmnqwwCg9LDhwECsvu+/g0CsZvCog8Cjcmqxw0CzZuNqA1hOZ5NMlIzFUJwRrZUOhQFHqBu/nSV8OL4ACAbFvgMuQ==" />
</div>
 

    
 
   <div id="body"> 
    <div class="PageTitle" > Script</div>
   
    <table cellspacing="0" border="0" id="InsertScriptFormView" style="background-color:White;border-collapse:collapse;">
      <tr valign="top">
            <td colspan="2">
 
        <table  width="100%">   
<tr>
<td align="center"> 
</td>
</tr>
<tr>
<td valign="top">
<select name="InsertScriptFormView$PublishTime" id="InsertScriptFormView_PublishTime" disabled="disabled" class="Dropdown-Admin-req" style="border-width:1pt;border-style:Solid;height:18px;width:80px;">
                  <option selected="selected" value=""></option>
                  <option value="01:00 AM">01:00 AM</option>
                  <option value="02:00 AM">02:00 AM</option>
                  <option value="03:00 AM">03:00 AM</option>
                  <option value="04:00 AM">04:00 AM</option>
                  <option value="05:00 AM">05:00 AM</option>
                  <option value="06:00 AM">06:00 AM</option>
                  <option value="07:00 AM">07:00 AM</option>
                  <option value="08:00 AM">08:00 AM</option>
                  <option value="09:00 AM">09:00 AM</option>
                  <option value="10:00 AM">10:00 AM</option>
                  <option value="11:00 AM">11:00 AM</option>
                  <option value="12:00 PM">12:00 PM</option>
                  <option value="01:00 PM">01:00 PM</option>
                  <option value="02:00 PM">02:00 PM</option>
                  <option value="03:00 PM">03:00 PM</option>
                  <option value="04:00 PM">04:00 PM</option>
                  <option value="05:00 PM">05:00 PM</option>
                  <option value="06:00 PM">06:00 PM</option>
                  <option value="07:00 PM">07:00 PM</option>
                  <option value="08:00 PM">08:00 PM</option>
                  <option value="09:00 PM">09:00 PM</option>
                  <option value="10:00 PM">10:00 PM</option>
                  <option value="11:00 PM">11:00 PM</option>
                  <option value="12:00 AM">12:00 AM</option>
 
            </select>
</formview>
</form>

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 38761671
line 9 to 25 it's not the code provided...
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now