views:

439

answers:

1

I have a page "MyPage.aspx" that calls "MyForm.aspx" with prototype

new Ajax.Updater('display', '/myform.aspx' etc....

However, when the page renders there are no validation scripts on the page.

ie, i don't see scripts like below when i call the page via ajax. If just call myForm.aspx i see the below scripts

<script type="text/javascript">
//<![CDATA[
var FlagForm1_RequiredFieldValidator1 = document.all ? document.all["FlagForm1_RequiredFieldValidator1"] : document.getElementById("FlagForm1_RequiredFieldValidator1");
FlagForm1_RequiredFieldValidator1.controltovalidate = "FlagForm1_TextBoxName";
FlagForm1_RequiredFieldValidator1.errormessage = "RequiredFieldValidator";
FlagForm1_RequiredFieldValidator1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
FlagForm1_RequiredFieldValidator1.initialvalue = "";
var FlagForm1_RequiredFieldValidator2 = document.all ? document.all["FlagForm1_RequiredFieldValidator2"] : document.getElementById("FlagForm1_RequiredFieldValidator2");
FlagForm1_RequiredFieldValidator2.controltovalidate = "FlagForm1_TextBoxEmail";
FlagForm1_RequiredFieldValidator2.errormessage = "RequiredFieldValidator";
FlagForm1_RequiredFieldValidator2.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
FlagForm1_RequiredFieldValidator2.initialvalue = "";
var FlagForm1_RequiredFieldValidator3 = document.all ? document.all["FlagForm1_RequiredFieldValidator3"] : document.getElementById("FlagForm1_RequiredFieldValidator3");
FlagForm1_RequiredFieldValidator3.controltovalidate = "FlagForm1_TextBoxComment";
FlagForm1_RequiredFieldValidator3.errormessage = "RequiredFieldValidator";
FlagForm1_RequiredFieldValidator3.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
FlagForm1_RequiredFieldValidator3.initialvalue = "";
//]]>
</script>
A: 

you need to set evalscripts:true. As the property name suggest this allows the scripts to be evaluated. Also, you need to put the scripts in the parent page.

   var myAjax = new Ajax.Updater(
                    'container',
                    url,
                    {
                    asynchronous:true,
                    method: 'get',
                    parameters: pars,
                    evalScripts: true,
                    onFailure: reportError
                    }
                 );
frosty