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
[FEATURE] - prompt #172
[FEATURE] - prompt #172
Conversation
Well done! But can you add "Cancel" option for the Prompt box as well? |
@zuofei Of course, you can add option showCancelButton: true. Example: swal({
type: "prompt",
title: "Prompt!",
text: "Enter your text here:",
showCancelButton: true,
promptPlaceholder: "Your text goes here...",
promptDefaultValue: "Some sweet default value"
}, function(value) {
swal("Here's a message!", "Your prompt was: " + value, "success");
}); |
Got it. Thank you! |
$okButton = modal.querySelector('button.confirm'); | ||
|
||
//prompt | ||
var $promptInput = modal.querySelector('.prompt-input'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an exact dupe of line 679.
Passing in imageSize does not work. The fix is to remove the following, because it's already being set right outside the if/else: $customIcon.css({
'width': imgWidth + 'px',
'height': imgHeight + 'px'
}); Also, if you specify an imageUrl, it currently shows both the Prompt icon and the custom image. To hide the prompt icon you need to add the following right below var $icons = modal.querySelectorAll('.icon');
hide($icons); |
@parterburn These are not issues related to prompt feature. I created another issue which address this problem here - #190 |
I like this feature! But... why the alert appears twice? I mean, it isn't like warning: you press Yes, delete it and the modal changes its markup almost instantly. However, when you press Ok using prompt, the modal disappears and then comes back. That isn't sweet 😞 |
@jobsamuel It's just example. You don't need to use another alert in callback. You can do anything you want after prompt is confirmed. |
Now I see @mkoczka! Thanks for the clarification 👍 |
Pressing spacebar while typing in the prompt input submits the confirmation. These changes fixed that for me. |
Great feature, i like it a lot! |
Due to popular demand, I have actively started looking into integrating this in a future release. I want to make some changes though so you're going to have to wait just a little longer. Just letting you guys know. Thanks so much for the contributions! :) |
Any update on this issue? We are using sweetAlert but are investigating vex to add custom prompts to our app but found some problems. Since both libraries lack the features we need we might as well help getting this feature into sweetAlert. |
I think this is being worked on in this PR: #90 |
Oh, thanks for pointing me in the right direction! |
👍 I wanted this feature. This will now become a replacement for bootstrap modals also. |
This has finally landed in v0.5.0 (although with a different implementation)! Download the latest release and follow the last part of this tutorial to get started: https://www.ludu.co/lesson/how-to-use-sweetalert. Thanks everyone for your suggestions! Keep it sweet! |
Here is my pull request of prompt feature. Requested in #155
I also updated example website with documentation.
Here is live example - http://mirokoczka.eu/sweetalert/example