简体   繁体   English

Alpaca Forms验证仅在用户离开字段后显示错误消息(离开字段)

[英]Alpaca Forms validation show error message only after user leaves field (leaves the field)

All the fields marked required are in red when the form loads since they are blank. 标签所需的所有字段在表单加载时都是红色的,因为它们是空白的。 How do I change this so that they only turn red (check validation) if/when someone leaves a particular field. 如果/当有人离开特定字段时,如何更改此设置以使它们仅变为红色(检查验证)。 This is specific to Alpaca forms. 这是羊驼形式特有的。

        $(document).ready(function() {
            $("#form").alpaca({
                "schema": {
                    "title":"User Feedback",
                    "description":"What do you think about Alpaca?",
                    "type":"object",
                    "properties": {
                        "volunteer_name": {
                            "type":"string",
                            "title":"Name of Civic Tutor",
                            "required":true
                        },
                    }
                }
            });
        });

Oh, there's actually a very simple solution to this. 哦,实际上有一个非常简单的解决方案。 Just add a "options": {"hideInitValidationError":true,....} to your form. 只需在表单中添加一个“选项”:{“hideInitValidationError”:true,....}。

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

相关问题 在用户离开字段后验证表单字段 - Validate form field after user leaves the field 用户离开字段后,立即显示AngularJS Bootstrap工具提示进行客户端验证 - Show AngularJS Bootstrap Tooltip for client-side validation as soon as user leaves field jQuery clone()在输入字段中保留用户数据 - jQuery clone() leaves user data in input field express-validator :仅显示一个字段的一个验证错误消息 - express-validator : show only one validation error message of a field jQuery 验证 - 仅显示最后验证字段的错误消息 - jQuery validation - only show error message of last field validated 如何在用户离开时不显示更改时显示警告消息 - How to show a warning message when user leaves without saving changes 用户离开现场时检查有效性并应用样式 - Check validity and apply style when user leaves the field jquery.val('') 不起作用,留下 0 而不是清除字段 - jquery .val('') not working, leaves a 0 instead of clearing the field jQuery 验证仅针对一个特定的 select 字段显示错误消息(引导程序选择) - jQuery Validation show error message for only one specific select field (bootstrap-select) 用户离开页面而不提交表单时如何显示警告消息 - how to show Warning message when user leaves the page without submitting the form
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM