bootboxjs / bootbox

Wrappers for JavaScript alert(), confirm() and other flexible dialogs using Twitter's bootstrap framework

Home Page:http://bootboxjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Featue request - Separate input attributes as options in bootbox.prompt

yhojann-cl opened this issue · comments

When use bootbox.prompt the input properties are declared in root options object, like as:

bootbox.prompt({
    title: "foo",
    placeholder: 'foo',
    class: 'foo',

But the input type text prompt is a html input and require other specials attributes, like as:

    <input
        class="text-danger"
        type="text"
        placeholder="foo"
        required
        maxlength="255"
        autocomplete="off"
        pattern="[^\\\/:;]+" />

But is a bad idea set the input attributes in the root settings. Please, put a dynamic input attributes for the html object, by example:

bootbox.prompt({
    title: "foo",
    controls: {
        input: {
            class: 'foo', type: 'text', placeholder: '', required: true, maxlength: 255, autocomplete: 'off', pattern: '...', etc
        }
    },

Well, two things:

  • The attributes and properties you mentioned can all be set via the options object (except perhaps "autocomplete") - I don't see how your suggestion really improves that, and
  • This would be a fairly drastic change to how the prompt template is generated, which equals major version bump, which also equals not likely to happen anytime soon.

A pull-request with your proposed changes, on the other hand, would be more likely to be accepted, assuming it provided tests showing that the existing behavior of prompt stays the same (in other words, the scenarios covered in the current tests must still work).