Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeking programmatic launch of Modal Form (no button, no anchor click) #11

Open
frankfont opened this issue Feb 24, 2019 · 1 comment
Open

Comments

@frankfont
Copy link

frankfont commented Feb 24, 2019

From conversation on 2/24/2019 confirmed there is no API at this time for programmatic launch of a modal form in UF_FormGenerator. The methods that do it are private behind the existing API.

In my case, I don't have a button and don't have an anchor tag in the UI that a click event can be bound to in the normal way. Instead, I need to launch the modal form from javascript in a custom event handler function provided by a context menu framework I'm using.

Enhancement request: Provide a public method that displays the modal form so that click event element binding is not required. For example ...

formGenerator.displayForm(options) { ... }
@lcharette
Copy link
Owner

Agreed. The only way to create a modal right now is through an onClick event bind to an HTML element :

/**
* Bind the display action for a form to the button
*/
display: function() {
this.$elements.on('click', $.proxy(this._fetchForm, this));
return this.$elements;
},

The _fetchForm private method (private, so can't be called manually) should be refactored, mostly to remove the event argument and provide normal options instead. The display method should be refactored and define the click event as an option. It could also be renamed to something clearer (with keywords like attach or bind) to make it clearer it purpose is to bind something to the element it's applied on.

Same goes for the confirmation modal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants