0

I am using Featherlight to display an HTML form and am not able to do the following:

  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.

I call the inital lightbox manually as a global variable so I can use the "persist" option:

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

...but I can't seem to get the "beforeOpen" syntax correct to prevent it from displaying:

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/

Any help would be appreciated. Thanks!

David L.
  • 43
  • 6

1 Answers1

0

First, you can set the persist option using data-featherlight-persist="true" if you prefer (same for all featherlight options).

Second, either you call $.featherlight(...) which will open a window immediately, or you bind a button with $('.my-button').featherlight(...) (or with data-featherlight). The second form will not open the dialog immediately, as you desire. I don't think you'll need beforeOpen at all.

Marc-André Lafortune
  • 78,216
  • 16
  • 166
  • 166
  • Marc, thanks for the response. Using my current implementation shown in the JSFiddle (as opposed to inline binding,) what is the syntax to prevent the lightbox from opening? Also, how can I trigger the onSubmit in the lightbox? (Should I change the input type to a button instead of a submit, and trigger the validation and submit in the JS?) Thanks for your help. – David L. Jan 06 '16 at 20:24