简体   繁体   English

在Featherlight中将onSubmit与表单一起使用?

[英]Using onSubmit with form in Featherlight?

I am using Featherlight to display an HTML form and am not able to do the following: 我正在使用Featherlight显示HTML表单,但无法执行以下操作:

  1. Load the page with the form hidden initially. 加载页面,表单最初处于隐藏状态。

  2. Have the form's "onSubmit" fire when the form is submitted using a standard HTML submit button. 使用标准HTML提交按钮提交表单时,请触发表单的“ onSubmit”。

I call the inital lightbox manually as a global variable so I can use the "persist" option: 我手动将初始灯箱称为全局变量,因此可以使用“ persist”选项:

lightboxForm = $.featherlight('#attendeeAddEditForm', { 'persist' : true });

...but I can't seem to get the "beforeOpen" syntax correct to prevent it from displaying: ...但是我似乎无法正确获取“ beforeOpen”语法以防止其显示:

beforeOpen: function(event){return false}

...doesn't work inside the above call. ...在上述调用中无效。

Here is a simplified version of what I am trying to do: 这是我正在尝试做的简化版本:

http://jsfiddle.net/djwljr/JNsu6/142/ http://jsfiddle.net/djwljr/JNsu6/142/

Any help would be appreciated. 任何帮助,将不胜感激。 Thanks! 谢谢!

First, you can set the persist option using data-featherlight-persist="true" if you prefer (same for all featherlight options). 首先,您可以根据需要使用data-featherlight-persist="true"设置持久选项(所有featherlight选项相同)。

Second, either you call $.featherlight(...) which will open a window immediately, or you bind a button with $('.my-button').featherlight(...) (or with data-featherlight ). 其次,您可以调用$.featherlight(...)来立即打开一个窗口,或者将按钮与$('.my-button').featherlight(...) (或data-featherlight )绑定。 The second form will not open the dialog immediately, as you desire. 第二种形式不会根据您的需要立即打开对话框。 I don't think you'll need beforeOpen at all. 我认为您完全不需要beforeOpen

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

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