bootbox.prompt does not work as expected as stated in the API documentation #543

Open
mondwan opened this Issue Sep 24, 2016 · 12 comments

Projects

None yet

4 participants

@mondwan
mondwan commented Sep 24, 2016 edited

Original post is #450.

According to document here, prompt accepts message and title. However, only title work.

Fiddler here

As the previous post, there is pending pull requests #397 and identical requests on #230 talking about same issues

@tiesont
Collaborator
tiesont commented Sep 24, 2016 edited

Documentation will be updated/corrected at some point, probably as soon as I get my pull-request squared away.

EDIT: documentation has been corrected.

@mondwan
mondwan commented Sep 24, 2016

Great. It clarifies the problem.

However, may I know why message is not allowed for prompt()?

In the last post, you have mentioned about disallowing message is because
of avoiding misleading inputs from developer (eg dialog in dialog).

Would it be nice for adding a check or allowance for simple text around the
input box provided by prompt?

Sometimes a little description or hint can better address the purpose of
prompt() addition on a single title

Thanks

2016年9月24日 14:34,"Tieson Trowbridge" notifications@github.com寫道:

Documentation will be updated/corrected at some point, probably as soon as
I get my pull-request squared away. You can see a work-in-progress, with
the updated prompt docs, here: https://tiesontrowbridge.com/
bootbox/documentation.html#bb-prompt-dialog


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#543 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADuAowSX-3QrC3boMSeWQQMLnhk_5-t-ks5qtMRegaJpZM4KFkTA
.

@tiesont
Collaborator
tiesont commented Sep 24, 2016

I would agree - I would prefer to be able to prepend a message to, say, a prompt with a textarea. That isn't how it's coded, though, so that's a question for @makeusabrew - there's a reason it's not allowed, and I would assume it was causing more problems than allowing it solves.

It's not optimal, but if you really want to use prompt instead of building a custom dialog, you can do something like this:

var dialog = bootbox.prompt({
  title: 'Some title',
  callback: function(result) {

  }
});

dialog.on('shown.bs.modal', function() {
  dialog.find('.bootbox-body').prepend('<p>Some extra text</p>')
});

or this:

bootbox.prompt({
  title: 'Some title',
  callback: function(result) {

  }
}).find('.bootbox-body').prepend('<p>Some extra text</p>');
@makeusabrew
Owner

I've always objected purely because Bootbox's guiding principle is to follow the native methods it replaces as closely as possible. What stops you putting whatever you want to put in 'message' in the title of the prompt?

@tiesont
Collaborator
tiesont commented Sep 27, 2016

@makeusabrew I'll put together some updated verbiage for the documentation (to explain why prompt works as it does), and add a version of the above code to the examples page. Sound good?

@makeusabrew
Owner

Sure; but as I said I'm genuinely curious what it is about prompt which doesn't currently fulfil people's needs; I've no desire to be stubborn about its functionality if there's a genuine need for change.

@mondwan
mondwan commented Sep 28, 2016

Ummm, how about a description about the required value format?

For example, prompt showing a title with input your name and there is a
description about name we accept alphanumeric only under or above the input
box?

2016年9月28日 16:59,"Nick Payne" notifications@github.com寫道:

Sure; but as I said I'm genuinely curious what it is about prompt which
doesn't currently fulfil people's needs; I've no desire to be stubborn
about its functionality if there's a genuine need for change.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#543 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADuAo9-rH0xEdloG9jyYmNI1KizJgq8hks5quixvgaJpZM4KFkTA
.

@makeusabrew
Owner

Okay; input restrictions / validation is one (pretty strong argument), but not necessarily as a freeform 'message' parameter (since that won't actually restrict or validate anything). Any others?

@mondwan
mondwan commented Sep 28, 2016

How about a disclaimer or warning?

For example, deleting a github repository will require you to enter the
name of repository for confirmation. In that box, there is a warning
statement about this cannot be undone.

It will be awkward if adding such statement into the title.

2016年9月28日 17:50,"Nick Payne" notifications@github.com寫道:

Okay; input restrictions / validation is one (pretty strong argument), but
not necessarily as a freeform 'message' parameter (since that won't
actually restrict or validate anything). Any others?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#543 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADuAozSKgxQWI-wa6MVW82wN-tevH-vMks5qujhrgaJpZM4KFkTA
.

@makeusabrew
Owner

True enough. Probably does merit adding.

@tiesont
Collaborator
tiesont commented Sep 28, 2016

Would the primary reason be to bring the prompt in line with the other dialogs (which do allow both title and message)? If not, the use case above could be accomplished with what I noted before. I'm not against it, and it would simplify the process a bit.

Otherwise, would we just need an admonishment in the docs that any form controls added to message will be ignored?

@djmattyg007

You could use $('selector').text() instead of $('selector').html() for message inside of a prompt.

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