Facebook 选项卡上的表单验证

发布于 2024-09-28 14:00:12 字数 627 浏览 0 评论 0原文

我正在使用静态 FBML,但在调试表单验证问题时遇到问题。我收到一个对话框,在我看来它应该返回 false,但表单无论如何都会提交。我正在使用 Firebug,我看到一条红色的简短消息,但我没有机会阅读。我很感激你的帮助:-)

var txt ='Enter Zipcode';
//...
function  setError(){
 var obj=document.getElementById('mapsearch');
        obj.setValue(txt);
        obj.setStyle('color', '#FF0000'); 
}
function valform(){
 var obj=document.getElementById('mapsearch');
 var val = obj.getValue();
 if(val!='' &&  !isNaN(val) && val.length>2 ){ 
  return true;
 } else {
  setError();
  (new Dialog()).showMessage('Zip Required', 'Please enter your zip code.');
  return false;
 }
}





 
 
    
//...


I am using static FBML but I am having trouble debugging a form validation problem. I get the dialog which to me seems like it should return false, but the form submits anyway. I am using Firebug and I see a brief message in Red that I have no chance to read. I appreciate the help :-)


var txt ='Enter Zipcode';
//...
function  setError(){
 var obj=document.getElementById('mapsearch');
        obj.setValue(txt);
        obj.setStyle('color', '#FF0000'); 
}
function valform(){
 var obj=document.getElementById('mapsearch');
 var val = obj.getValue();
 if(val!='' &&  !isNaN(val) && val.length>2 ){ 
  return true;
 } else {
  setError();
  (new Dialog()).showMessage('Zip Required', 'Please enter your zip code.');
  return false;
 }
}





 
 
    
//...


如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独孤求败 2024-10-05 14:00:12

如果 Firebug 中的 Firebug/javascript 错误消息消失得太快,请尝试“坚持”按钮。这样,所有消息都会在页面加载之间保留,直到您单击“清除”为止。

Try the "Persist" button if the Firebug/javascript error message in Firebug disappears too quickly. This way all messages are kept between page loads until you click "Clear".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文