kentico_borisp
-
1/13/2011 6:17:24 AM
RE:Disable BizForm Field Validation in Custom code?
Hello,
I would recommend you the following approach:
1) Create two custom form controls, one for the dropdown and one for all the input fields (e.g. 3 times the First name, Last name email...etc). Those input fields will be named differently for each presenter, e.g (just an example).
<div id="P1">
FirstNameTextBox_1, LastNameTextBox_1,
</div>
<div id="P2">
FirstNameTextBox_2, LastNameTextBox_2,
</div>
<div id="P3">
FirstNameTextBox_3, LastNameTextBox_3
</div>
Those sections will be encapsulated in three div containers with different ids , so you can dynamically hide/show themaccording to the dropdown selection.
2) In the dropdown custom form control you can set the selected number of presenters as a cookie/session/thread value.
3) You can get this value in the "public override bool IsValid()" method of the textbox cestom form control and validate the fields according to this (e.g. check if there is some text in FirstNameTextBox_2.Text if 2 presenters are selected )
4) The validation messasge can be set the following way:
this.ValidationError = "Please insert something in field First Name by presenter 2";
Best regards, Boris Pocatko
|