如何在按钮点击时验证两个控件(tinymce textarea和单选按钮)。 [英] how to validate two controls ( tinymce textarea and radio button both ) at time when button click.
问题描述
朋友们,
i需要在按钮点击时同时验证textarea(tinymce)和单选按钮(必须选择一个)。
i有两个验证码,但它的功能不同,我如何调用或如何合并这两个函数,请在我的代码下面找到
textarea(tinymce)验证
============================== br />
hi friends,
i need to validate textarea(tinymce), and radio button(aleast one must be selected) at same time when button click.
i have validation code for both, but its different function, how i call or how i merge these two function,pls find below my code
textarea(tinymce) validation
==============================
<script type="text/javascript">
function validate_textarea() {
var textarea = tinyMCE.get('textar_Question1').getContent();
if ( (textarea=="") || (textarea==null) )
{
$('#divValidaTetextarea').modal({show:true})
//alert("Post body must not be left blank");
//textarea.focus();
return false;
}
else
{
alert("ok");
}
}
</script>
无线电验证
================
Radio validation
================
function isOneChecked() {
var chx = document.getElementsByTagName('input');
for (var i=0; i<chx.length; i++) {
if (chx[i].type == 'radio' && chx[i].checked) {
return true;
}
}
alert("Please select option");
// End of the loop, return false
return false;
}
html
=====
html
=====
<a type="button" id="btnAddQuestion" class="btn" >AddQuestion</a>
任何人请与我分享您的想法。
谢谢:)
anyone pls share with me your ideas.
thanks :)
推荐答案
(' #divValidaTetextarea')。modal({show: true })
// alert(帖子正文不能留空);
// textarea.focus();
return false ;
}
其他
{
alert( ok);
}
}
< / script>
('#divValidaTetextarea').modal({show:true}) //alert("Post body must not be left blank"); //textarea.focus(); return false; } else { alert("ok"); } } </script>
无线电验证
================
Radio validation
================
function isOneChecked() {
var chx = document.getElementsByTagName('input');
for (var i=0; i<chx.length; i++) {
if (chx[i].type == 'radio' && chx[i].checked) {
return true;
}
}
alert("Please select option");
// End of the loop, return false
return false;
}
html
=====
html
=====
<a type="button" id="btnAddQuestion" class="btn" >AddQuestion</a>
任何人请与我分享您的想法。
谢谢:)
anyone pls share with me your ideas.
thanks :)
这篇关于如何在按钮点击时验证两个控件(tinymce textarea和单选按钮)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!