aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/nfvo-components/input
diff options
context:
space:
mode:
authorsvishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>2018-05-08 16:15:21 +0300
committerEinav Keidar <einavw@amdocs.com>2018-05-09 07:26:12 +0000
commit3b0bea525ed2051f3635dfd6800f156601aa8c0d (patch)
tree0b11b67e72d5905dc3b4988afdccd85d596e4b88 /openecomp-ui/src/nfvo-components/input
parent738df130864363bcb8b18c3b726f0587acaf74fd (diff)
nic creation issue fix
Issue-ID: SDC-1274 Change-Id: Ifd9297d3559f1b8820b0a64f063f1211b6957dd4 Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/nfvo-components/input')
-rw-r--r--openecomp-ui/src/nfvo-components/input/validation/Form.jsx20
1 files changed, 14 insertions, 6 deletions
diff --git a/openecomp-ui/src/nfvo-components/input/validation/Form.jsx b/openecomp-ui/src/nfvo-components/input/validation/Form.jsx
index 62fc29a55c..b5db67c027 100644
--- a/openecomp-ui/src/nfvo-components/input/validation/Form.jsx
+++ b/openecomp-ui/src/nfvo-components/input/validation/Form.jsx
@@ -70,8 +70,8 @@ class Form extends React.Component {
return (
<form
{...formProps}
- ref={form => (this.form = form)}
- onSubmit={event => this.handleFormValidation(event)}>
+ ref={this.setFormRef}
+ onSubmit={this.handleFormValidation}>
<div className="validation-form-content">
<fieldset disabled={isReadOnlyMode}>{children}</fieldset>
</div>
@@ -80,7 +80,7 @@ class Form extends React.Component {
labledButtons={labledButtons}
submitButtonText={submitButtonText}
cancelButtonText={cancelButtonText}
- ref={buttons => (this.buttons = buttons)}
+ ref={this.setButtonsRef}
isReadOnlyMode={isReadOnlyMode}
/>
)}
@@ -88,14 +88,19 @@ class Form extends React.Component {
);
}
- handleFormValidation(event) {
+ handleFormValidation = event => {
event.preventDefault();
if (this.props.onValidateForm && !this.props.formReady) {
return this.props.onValidateForm();
} else {
return this.handleFormSubmit(event);
}
- }
+ };
+
+ setButtonsRef = buttons => (this.buttons = buttons);
+
+ setFormRef = form => (this.form = form);
+
handleFormSubmit(event) {
if (event) {
event.preventDefault();
@@ -128,7 +133,10 @@ class Form extends React.Component {
this.props.onValidityChanged(this.props.isValid);
}
}
- if (this.props.formReady) {
+ if (
+ this.props.formReady &&
+ this.props.formReady !== prevProps.formReady
+ ) {
// if form validation succeeded -> continue with submit
this.handleFormSubmit();
}