diff options
author | gebele <gebele@in-silico.ch> | 2013-03-20 16:31:38 +0100 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2013-03-20 16:31:38 +0100 |
commit | 84bb7c7ff4afcb1ad7ad1c68f0eb778c64f63183 (patch) | |
tree | fd6bdaa8dcd71ecac0c0684713f43dce6b18482b /views/predict.haml | |
parent | 8c893bcb65d0d460a26918a053e80d95828208f7 (diff) |
check input
Diffstat (limited to 'views/predict.haml')
-rw-r--r-- | views/predict.haml | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/views/predict.haml b/views/predict.haml index 8ee3558..064ed60 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -2,10 +2,26 @@ function getsmiles() { if (document.JME.smiles() != '') { document.form.identifier.value = document.JME.smiles() ; - } - } - -%form{:name => "form", :action => to('/predict'), :method => "post", :enctype => "multipart/form-data" } + }; + }; + function checksmiles () { + if (document.form.identifier.value == "") { + alert("Please insert a compound.") + document.form.identifier.focus(); + return false; + }; + return true; + }; + function checkboxes () { + if ($("#model input[type=checkbox]:checked").length < 1 ){ + alert("Please select an endpoint.") + document.getElementById('model').focus(); + return false; + }; + return true; + }; + +%form{:name => "form", :action => to('/predict'), :method => "post", :enctype => "multipart/form-data", :onsubmit => "return !!(checksmiles() & checkboxes())" } %fieldset#top %a{:href => "#insert", :id => "linkInsert"} %h1 1. Draw or insert your compound @@ -21,6 +37,7 @@ %applet{:code => "JME.class", :name => "JME", :archive => "JME.jar", :width => "500", :height => "360"} %param{ :name => "options", :value => "polarnitro"} Please enable Java and JavaScript in your browser to use the JME editor. + %a{:href => "jme_help", :rel => "external"} (help) %span{:style=>"font-size:75%"} © %a{:href => 'http://www.molinspiration.com/jme/index.html', :rel => "external"} JME Editor @@ -55,7 +72,8 @@ - @models.each do |model| - model.get #model - %input{:type => 'checkbox', :name => "selection[#{model.title}]", :value => true, :disabled => false} + %input{:type => "checkbox", :name => "selection[#{model.title}]", :id => "selection[#{model.title}]", :value => true, :disabled => false} + %label{:for => "selection[#{model.title}]"} %b= model.title %a{:href=>"#", :alt=>"#{model.title} validation"} %i Validation Link @@ -70,6 +88,8 @@ %fieldset#bottom %a{:href => "#predict", :id => "linkPredict"} - %h1 3. Predict - %input{ :type => "submit", :value=>">>", :onclick => "getsmiles();"} + %label{:for => "submit"} + %h1 3. Predict + %input{ :type => "submit", :id => "submit", :value=>">>", :onclick => "getsmiles()"} + |