madina1
asked on
validation control
i have a 2 combobox and a 1 textbox and a search button
1) country combobox
2) state combobox
3) textbox
when user click on search button without entering anything in the textbox then i'm inforcing user to enter (1) country and (2) city name (first 3 characters) which works great but i have a new requirement:
when the user select country = "United States" then i have to make sure user select
1)Country
2)State
3) city name (first 3 characters)
how do i do that?
1) country combobox
2) state combobox
3) textbox
when user click on search button without entering anything in the textbox then i'm inforcing user to enter (1) country and (2) city name (first 3 characters) which works great but i have a new requirement:
when the user select country = "United States" then i have to make sure user select
1)Country
2)State
3) city name (first 3 characters)
how do i do that?
ASKER
i'm talking about validation control that come along with visual studio asp.net 2
may be i'm confused what you post
may be i'm confused what you post
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nuno Godinho:
a runtime error has occurred
line 50
error: expected '('
here is my aspx code:
<table style="width: 316px">
<tr>
<td style="width: 150px">
<radcb:RadComboBox
id="ddlCountry"
Runat="server"
Height="140px"
Width="150px"
Skin="WindowsXP"
ShowToggleImage="True"
/>
</td>
<td style="width: 27px">
<asp:RequiredFieldValidato r ID="RequiredFieldValidator _Country" runat="server" ControlToValidate="ddlCoun try" ErrorMessage="Select Country" Display="Dynamic" Width="6px">*</asp:Require dFieldVali dator></td >
</tr>
<tr>
<td style="width: 150px">
<radcb:RadComboBox
id="ddlState"
Runat="server"
Height="140px"
Width="150px"
Skin="WindowsXP"
ShowToggleImage="True"
/>
<td style="width: 27px"><asp:RequiredFieldVa lidator ID="RequiredFieldValidator _State" runat="server" ErrorMessage="Select State" Width="6px" ControlToValidate="ddlStat e">*</asp: RequiredFi eldValidat or></td>
<tr>
<td style="height: 26px">
<asp:TextBox runat="server" ID="txt" Width="167px"></asp:TextBo x>
</td>
<td style="width: 27px; height: 26px">
<asp:RequiredFieldValidato r ID="RequiredFieldValidator _City" runat="server" ControlToValidate="txt" ErrorMessage="Enter City name" Width="6px" Display="Dynamic">*</asp:R equiredFie ldValidato r></td>
<td style="width: 291px; height: 26px;"><asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click ">Help Me Choose</asp:LinkButton></t d>
</tr>
</td>
<td style="width: 27px">
</td>
</tr>
</table>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
<br />
<script type="text/javascript">
var _ddlState = <%= ddlState.ClientID %>;
//
function loadBuilding(item)
{
_ddlState.SetText('<%=aspx _WaitLoadi ng %>');
if (item.Index > 0)
{
_ddlState.RequestItems(ite m.Value, false);
}
else
{
_ddlState.ClearSelection() ;
_ddlState.SetText('<%= aspx_SelectBuilding %>');
_ddlState.RequestItems("", false);
}
}
//
function ItemsLoaded(combo)
{
if (combo.Items.length > 0)
{
combo.SetText(combo.Items[ 0].Text);
}
combo.ShowDropDown();
}
</script>
a runtime error has occurred
line 50
error: expected '('
here is my aspx code:
<table style="width: 316px">
<tr>
<td style="width: 150px">
<radcb:RadComboBox
id="ddlCountry"
Runat="server"
Height="140px"
Width="150px"
Skin="WindowsXP"
ShowToggleImage="True"
/>
</td>
<td style="width: 27px">
<asp:RequiredFieldValidato
</tr>
<tr>
<td style="width: 150px">
<radcb:RadComboBox
id="ddlState"
Runat="server"
Height="140px"
Width="150px"
Skin="WindowsXP"
ShowToggleImage="True"
/>
<td style="width: 27px"><asp:RequiredFieldVa
<tr>
<td style="height: 26px">
<asp:TextBox runat="server" ID="txt" Width="167px"></asp:TextBo
</td>
<td style="width: 27px; height: 26px">
<asp:RequiredFieldValidato
<td style="width: 291px; height: 26px;"><asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click
</tr>
</td>
<td style="width: 27px">
</td>
</tr>
</table>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
<br />
<script type="text/javascript">
var _ddlState = <%= ddlState.ClientID %>;
//
function loadBuilding(item)
{
_ddlState.SetText('<%=aspx
if (item.Index > 0)
{
_ddlState.RequestItems(ite
}
else
{
_ddlState.ClearSelection()
_ddlState.SetText('<%= aspx_SelectBuilding %>');
_ddlState.RequestItems("",
}
}
//
function ItemsLoaded(combo)
{
if (combo.Items.length > 0)
{
combo.SetText(combo.Items[
}
combo.ShowDropDown();
}
</script>
ASKER
when i click on the button to select
i get the a error window:
microsoft jscript runtime error: object expected
ClientValidate(val, args);
i get the a error window:
microsoft jscript runtime error: object expected
ClientValidate(val, args);
ASKER
Nuno Godinho
the best example is here
http://www.peterblum.com/vam/DemoAll.aspx
when you select "united states" or "canada" the STATE required field is popup
same exact thing i want to implement
thanks.
the best example is here
http://www.peterblum.com/vam/DemoAll.aspx
when you select "united states" or "canada" the STATE required field is popup
same exact thing i want to implement
thanks.
add Item "NONE" to your state combobox for none USA countries ....
and add these lines to search button onclick event =>
if (countrycombo.Items.Item[c
{goto next page}
HRV