Skip to content

Commit 96b354e

Browse files
committed
Merge pull request #2446 from jeff1evesque/bug-2445
#2445: Clear components when another model chosen
2 parents 420b36b + 5438e79 commit 96b354e

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/jsx/import/input-data/supply_dataset_url.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ var SupplyDatasetUrl = React.createClass({
111111
/>
112112

113113
{/* array components require unique 'key' value */}
114-
{inputs && inputs.map(function(value, index){
114+
{inputs && inputs.map(function(value, index){
115115
return <input
116116
type='url'
117117
name='svm_dataset[]'

src/jsx/import/input-data/supply_predictors.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ var SupplyPredictors = React.createClass({
2525
var predictors = document.getElementsByClassName('predictionInput');
2626

2727
{/*
28-
Iterate the node list containing the supplied dataset(s). If the
29-
input value is a valid file, store 'true', within the array.
28+
Iterate the node list containing the supplied predictors(s). If
29+
input value is a valid float, store 'true', within the array.
3030
*/}
3131
var boolArray = Array.prototype.map.call(
3232
predictors,
@@ -62,7 +62,7 @@ var SupplyPredictors = React.createClass({
6262

6363
{/* array components require unique 'key' value */}
6464
{options && options.map(function(value, index){
65-
var suffix = index.toString()
65+
var suffix = index.toString();
6666
var predictor = this.state['value_predictor_' + suffix];
6767

6868
return <input
@@ -72,7 +72,7 @@ var SupplyPredictors = React.createClass({
7272
placeholder={value}
7373
key={index}
7474
onChange={this.validIntegerEntered}
75-
value={predictor}
75+
// value={predictor}
7676
/>;
7777
}.bind(this))}
7878

src/jsx/import/session-type/model_predict.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,22 @@ var ModelPredict = React.createClass({
2626
changeModelId: function(event){
2727
var modelId = event.target.value;
2828

29+
// clear predictors, remove submit button
30+
var predictors = document.getElementsByClassName('predictionInput');
31+
32+
if (predictors) {
33+
for (var i = 0; i < predictors.length; i++) {
34+
predictors[i].value='';
35+
}
36+
}
37+
this.props.onChange({render_submit: false});
38+
39+
// store modelId into state
2940
if (modelId && modelId != '--Select--' && checkValidInt(modelId)) {
3041
this.setState({value_model_id: event.target.value});
3142
}
3243
else {
3344
this.setState({value_model_id: '--Select--'});
34-
this.props.onChange({render_submit: false});
3545
}
3646
},
3747
// update 'state properties' from child component (i.e. 'validStringEntered')

0 commit comments

Comments
 (0)