views:

1412

answers:

1

hey ,

I know that a lot of people ask this before , am using really easy field validation with prototype , its very nice script , but the problem that i use this thing in an ajax form .

i know that your answer will be to extend the elements in my js code , the problem is not in the validation.js code itself but in another function that i built to check if all fields in the form are valid according to validation.js rules , if it's all ok then the code go and call the function that include the ajax request , its work in ff and chrome and opera , but not in ie .

now i know that the problem in the function validf() but i dont know which element to extend and exactly how , this is the whole stroy !!

the Code of js functions :

function validf(){
     var valid = new Validation('addCom');
     var vresult = valid.validate();
     if(vresult){
     return sendCom();
     }else{
     $('result').innerHTML= '';
     }
}

function sendCom() {
 new Ajax.Request("sendcom.html", 
 { 
 method: 'post', 
 postBody: 'author='+ $F('author') +'&plc='+ $F('plc') +'&email='+ $F('email') +'&text='+ $F('text'),
 onComplete: showResponse 
 });
}

function showResponse(req){
 $('result').innerHTML= req.responseText;
}

the HTML Code of the form :

<form id="addCom" name="addCom" onsubmit="return false;">

    <input type="hidden" id="postid" name="postid" value="$id" />
    <input type="hidden" id="type" name="type" value="news" />

 <label for="author">name :</label><br />
 <div class="inroundi"><input type="text" id="author" name="author" class="validate-input" /></div>

 <label for="plc">place :</label>
 <br />
 <div class="inroundi"><input type="text" id="plc" name="plc" class="validate-input" /></div>

 <label for="email">email :</label>
 <br />
 <div class="inroundi"><input type="text" id="email" name="email" class="validate-email" /></div>

 <label for="text">comment :</label>
 <br />
 <div class="inroundt"><textarea id="text" name="text" class="validate-textarea"></textarea></div>
 <br />
 <div id="result"></div>
 <input type="submit" value="send" onClick="validf()" />

</form>
<script type="text/javascript">
    new Validation('addCom',{immediate : true});
</script>

thank you all .

A: 

Will thanks for every good guy who help !!

anyway i get the solution ,

 <div id="result"></div>

this is was similar to another object id in the file validation.js , what i made is to rename it .

that's all .

ebncana