简体   繁体   English

使用Symfony 2.0验证表单

[英]Validate a form in view with Symfony 2.0

I work with symfony 2.0 and I have a view (test.html.php) that contains a 我使用symfony 2.0,并且有一个视图(test.html.php)包含一个

form:
<form action="" method="post" rel="">
    <input type="hidden" name="action" value="test" />
    <input name="myinput" type="text" value=""/>
    <input type="submit" class="button" value="Go" />
</form>

This form sends the value of myinput to testAction in ActionController (and it works) but I wanna add a validation function with jQuery and/or AJAX to validate the myinput value before sending it to the controller and I don't know where to integrate it exactly 这种形式将myinput的值发送到ActionController中的testAction(并且可以工作),但是我想用jQuery和/或AJAX添加验证函数以在将myinput值发送到控制器之前对其进行验证,并且我不知道在哪里集成它究竟

Thank you in advance 先感谢您

您可以将HTML5验证用于客户端验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM