RequiredFieldValidator is not working on PeopleEditor control
Hi all,
I am using a PeopleEditor control in my custom aspx form for sharepoint. In that I am also using a requiredfieldvalidator control to validate that PeopleEditor control. For the 1st time if the PeopleEditor control is empty then the validator control is working perfectly. But after having some data in PeopleEditor control if the page postback is occurred due to some other control (like, on selection changed in a dropdownlist), though the data is still in PeopleEditor control, the RequiredFieldValidator control sensing my PeopleEditor control as empty and showing the error message.
Can anyone show me some light why this is happening and is there any solution to this?
Answers
You should see my blog entry to understand why this incompatibility exists: http://msinnovations.spaces.live.com/blog/cns!62E68922E47BC425!180.entry.
Thanks,
All Replies
Hi,
Do you have an example of your code?
It should be something along the lines of.
Code SnippetRequiredFieldValidator
validator = new RequiredFieldValidator();validator.ControlToValidate =
"MyPeoplePicker";validator.ErrorMessage =
"Please select a person.";validator.Display = System.Web.UI.WebControls.
ValidatorDisplay.Static;Controls.Add(validator);
Are you doing this in a web part?
Cheers
Hi Toby,
Thanx for your response.
I am not using any web part for this. I am using whole these in a custom aspx page and have placed in inside layouts folder. From there i am accessing the page into my sharepoint site.
my code is...
<td align="left" colspan="2" rowspan="" style="width: 600px;" valign="top" class="ms-formbody">
<wssawc
eopleEditor
AllowEmpty="false"
ID="pplProjectManager"
runat="server"
SelectionSet="User,SecGroup,SPGroup"
width='500px' Rows='1' PlaceButtonsUnderEntityEditor="false" MaximumEntities='1'/><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator_ProjectManager" runat="server"
ControlToValidate="pplProjectManager" ErrorMessage="Please enter Project Manager's name" Font-Names="Arial" Font-Size="XX-Small" Visible="True"></asp:RequiredFieldValidator></td>
You should see my blog entry to understand why this incompatibility exists: http://msinnovations.spaces.live.com/blog/cns!62E68922E47BC425!180.entry.
Thanks,
- Hi all,
If you're going to look the source on IE Dev, you will notice the text area ID with the following name [ControlID]$downlevelTextBox. You can use that to ControlToValidate property.
Cheers.


