Skip to content

Instantly share code, notes, and snippets.

@DavidePastore
Forked from nahakiole/bb-html-form.js
Last active August 21, 2016 11:20
Show Gist options
  • Save DavidePastore/7ff640c9c45f31cc95b5582ef69ad546 to your computer and use it in GitHub Desktop.
Save DavidePastore/7ff640c9c45f31cc95b5582ef69ad546 to your computer and use it in GitHub Desktop.
Use buttons and improve the format
bootbox.dialog({
title: "This is a form in a modal.",
message: '<div class="row"> ' +
'<div class="col-md-12"> ' +
'<form class="form-horizontal"> ' +
'<div class="form-group"> ' +
'<label class="col-md-4 control-label" for="name">Name</label> ' +
'<div class="col-md-4"> ' +
'<input id="name" name="name" type="text" placeholder="Your name" class="form-control input-md"> ' +
'<span class="help-block">Here goes your name</span> </div> ' +
'</div> ' +
'<div class="form-group"> ' +
'<label class="col-md-4 control-label" for="awesomeness">How awesome is this?</label> ' +
'<div class="col-md-4"> <div class="radio"> <label for="awesomeness-0"> ' +
'<input type="radio" name="awesomeness" id="awesomeness-0" value="Really awesome" checked="checked"> ' +
'Really awesome </label> ' +
'</div><div class="radio"> <label for="awesomeness-1"> ' +
'<input type="radio" name="awesomeness" id="awesomeness-1" value="Super awesome"> Super awesome </label> ' +
'</div> ' +
'</div> </div>' +
'</form> </div> </div>',
buttons: [
{
key: 'success',
label: "Save",
className: "btn-success",
callback: function () {
var name = $('#name').val();
var answer = $("input[name='awesomeness']:checked").val()
Example.show("Hello " + name + ". You've chosen <b>" + answer + "</b>");
}
}
]
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment