Thursday, April 25, 2024
134
rated 0 times [  141] [ 7]  / answers: 1 / hits: 45424  / 11 Years ago, tue, may 28, 2013, 12:00:00

How can I have 2 inputs instead of just one in Bootstrap's Bootbox?



I need to receive 2 values in a modal dialog.


More From » twitter-bootstrap

 Answers
2

Actually, there is a simpler way which doesn't require you to modify bootbox code.



The string you pass at the bootbox creation doesn't have to be only text: it can also be html code. That means you can include pretty much everything in the box.



To put a custom form in a bootbox, you can then create it as follow :



bootbox.confirm(<form id='infos' action=''>
First name:<input type='text' name='first_name' /><br/>
Last name:<input type='text' name='last_name' />
</form>, function(result) {
if(result)
$('#infos').submit();
});

[#77977] Monday, May 27, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rhett

Total Points: 671
Total Questions: 100
Total Answers: 102

Location: Hong Kong
Member since Tue, Oct 19, 2021
3 Years ago
rhett questions
Thu, Oct 28, 21, 00:00, 3 Years ago
Mon, Aug 2, 21, 00:00, 3 Years ago
Fri, Dec 11, 20, 00:00, 3 Years ago
Fri, Aug 7, 20, 00:00, 4 Years ago
Thu, Mar 26, 20, 00:00, 4 Years ago
;