added disabled state to submit when no model is selected

This commit is contained in:
Victor Nguyen 2013-03-05 00:05:27 +11:00
parent 58840ba128
commit ea3bbc4ebd
3 changed files with 17 additions and 2 deletions

View file

@ -10,7 +10,7 @@
h3 { text-align:center; padding-bottom:0.8em; }
#modal-trigger { display:block; margin:1em auto; }
#help { font-size:13px; margin-left:15px; opacity:0.7 }

View file

@ -14,6 +14,7 @@
$modifier = $('#modifier input'),
$minified = $('#minified input'),
$submit = $('#submit');
$help = $('#help');
// bind event handlers
$options.click( _handleSelect );
@ -26,6 +27,7 @@
e.preventDefault();
_setSelectedModel(this);
_setSelectLabel(model.name);
_enableSubmit();
}
function _handleSubmit(e) {
@ -54,6 +56,16 @@
$submit.button('reset');
}
function _disableSubmit() {
$submit.attr('disabled', 'disabled');
// $help.fadeIn(100);
}
function _enableSubmit() {
$submit.removeAttr('disabled');
// $help.fadeOut(100);
}
function _setSelectedModel(option) {
var $option = $(option);
model = {

View file

@ -18,7 +18,10 @@ block content
label#minified.checkbox
input(type='checkbox', checked)
| Minified output
button#submit.btn.btn-primary.btn-large(data-loading-text='Fetching specs...') Get Specs
button#submit.btn.btn-primary.btn-large(disabled, data-loading-text='Fetching specs...') Get Specs
//- span#help.help-inline
//- i.icon-exclamation-sign
//- | Select a model first!
div#results.row-fluid
div.span4
h3 Model Name