TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pothi Sam
NA
335
50.8k
i need to enable requirfield validator via javascript
Oct 20 2014 5:35 AM
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Airbooking.aspx.cs" Inherits="Airbooking" %>
<!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">
<head runat="server">
<title></title>
<%-- <link rel="stylesheet" href="css/Vallitator.js" />--%>
<script type="text/javascript">
function Validation()
{
if (document.Form1.txtfrom1.value.length > 0)
ValidatorEnable(document.getElementById("<%=Rftxtfrom1.ClientID %>").enabled = true);
ValidatorEnable(document.getElementById("<%=Rftxtfrom2.ClientID %>").enabled = true);
ValidatorEnable(document.getElementById("<%=Rftxtjd1.ClientID %>").enabled = true);
ValidatorEnable(document.getElementById("<%=Rfflno1.ClientID %>").enabled = true);
ValidatorEnable(document.getElementById("<%=Rfdep1.ClientID %>").enabled = true);
else
ValidatorEnable(document.getElementById("<%=Rftxtfrom1.ClientID %>").enabled = false);
ValidatorEnable(document.getElementById("<%=Rftxtfrom2.ClientID %>").enabled = false);
ValidatorEnable(document.getElementById("<%=Rftxtjd1.ClientID %>").enabled = false);
ValidatorEnable(document.getElementById("<%=Rfflno1.ClientID %>").enabled = false);
ValidatorEnable(document.getElementById("<%=Rfdep1.ClientID %>").enabled = false);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
background-color: #FFF;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="100%" height="360" border="1">
<tr>
<td><table width="100%" border="0">
<tr>
<td colspan="10"><div align="center">REQUISITION FOR AIR TICKET BOOKING </div></td>
</tr>
<tr>
<td width="3%">No</td>
<td width="17%">From Place</td>
<td width="17%">To Place</td>
<td width="17%">Date Of Journey</td>
<td width="17%">Flight No:</td>
<td width="17%">Departure Time </td>
</tr>
<tr>
<td>1.</td>
<td class="style1">
<asp:TextBox ID="txtfrom1" runat="server" ></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtfrom1" runat="server" ErrorMessage="*" ControlToValidate="txtfrom1" Enabled="true"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtto1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtto1" runat="server"
ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtjd1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtjd1" runat="server"
ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtflno1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rfflno1" runat="server"
ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtdep1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rfdep1" runat="server"
ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>2.</td>
<td class="style1">
<asp:TextBox ID="txtfrom2" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtfrom2" runat="server"
ErrorMessage="*" Enabled="false"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtto2" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtto2" runat="server"
ErrorMessage="*" Enabled="false"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtjd2" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtjd2" runat="server"
ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtflno2" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtflno2" runat="server"
ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
<td>
<asp:TextBox ID="txtdep2" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="Rftxtdep2" runat="server"
ErrorMessage="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>3.</td>
<td class="style1">
<asp:TextBox ID="txtfrom3" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtto3" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtjd3" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtflno3" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtdep3" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>4.</td>
<td class="style1">
<asp:TextBox ID="txtfrom4" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtto4" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtjd4" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtflno4" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtdep4" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="10"><table width="100%" border="1">
<tr>
<td width="3%"> </td>
<td width="5%">Prno</td>
<td width="9%">Name</td>
<td width="8%">Designation</td>
<td width="75%">Mobile No </td>
</tr>
<tr>
<td>1</td>
<td>
<asp:TextBox ID="prno1" runat="server" Width="55px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="name1" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="des1" runat="server" Width="72px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="mo1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>2</td>
<td>
<asp:TextBox ID="prno2" runat="server" Width="55px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="name2" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="des2" runat="server" Width="72px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="mo2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>3</td>
<td>
<asp:TextBox ID="prno3" runat="server" Width="55px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="name3" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="des3" runat="server" Width="72px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="mo3" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>4</td>
<td>
<asp:TextBox ID="prno4" runat="server" Width="55px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="name4" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="des4" runat="server" Width="72px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="mo4" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>5</td>
<td>
<asp:TextBox ID="prno5" runat="server" Width="55px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="name5" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="des5" runat="server" Width="72px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="mo5" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>6.</td>
<td>
<asp:TextBox ID="prno6" runat="server" Width="55px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="name6" runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="des6" runat="server" Width="72px"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="mo6" runat="server"></asp:TextBox>
</td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td class="style1"> </td>
<td> </td>
<td> </td>
<td>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="Validation(); return false;" />
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="style1"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td class="style1"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</div>
</form>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
texbox(txtfrom1,txtto1,txtjd1,txtflno,txtdep1) requirfield validator always enabled.(txtfrom2,txtto2,txtjd2,txtflno2,txtdep2 are requirfield validator disabled ) then customer entered second flight detail txtbox2 a single letter (txtfrom2,txtto2,txtjd2,txtflno2,txtdep2) requirfield validator automaticaly ennabled in javascript help me
Reply
Answers (
1
)
Regular Expression for string formation
Regular Expression