Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
7e67e940
Commit
7e67e940
authored
Apr 09, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_parameter_editor: Prevent submit form if form is invalid
This implements checkValidity properly.
parent
78f68708
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
master/bt5/slapos_parameter_editor/SkinTemplateItem/portal_skins/slapos_parameter_editor/gadget_erp5_page_slap_parameter_form.js.js
...rameter_editor/gadget_erp5_page_slap_parameter_form.js.js
+31
-3
No files found.
master/bt5/slapos_parameter_editor/SkinTemplateItem/portal_skins/slapos_parameter_editor/gadget_erp5_page_slap_parameter_form.js.js
View file @
7e67e940
...
...
@@ -141,7 +141,7 @@
var
serialisation_type
=
getSerialisationTypeFromForm
(
g
.
element
);
if
(
serialisation_type
===
"
json-in-xml
"
)
{
return
jsonDictToParameterJSONInXML
(
json_dict
);
}
}
return
jsonDictToParameterXML
(
json_dict
);
});
}
...
...
@@ -514,7 +514,7 @@
software_type_list
=
options
.
software_type_list
;
}
if
(
options
.
softwaretype
==
""
||
options
.
softwaretype
===
null
)
{
if
(
options
.
softwaretype
==
=
""
||
options
.
softwaretype
===
null
)
{
// Drop emtpy value for consistency
delete
options
.
softwaretype
;
}
...
...
@@ -642,7 +642,35 @@
content_dict
.
text_content
=
xml_result
;
return
content_dict
;
});
},
{
mutex
:
'
statechange
'
});
},
{
mutex
:
'
statechange
'
})
.
declareMethod
(
'
checkValidity
'
,
function
()
{
var
g
=
this
;
return
g
.
getElement
()
.
push
(
function
(
element
)
{
var
text_content
=
element
.
querySelector
(
'
textarea[name=text_content]
'
),
doc
;
if
(
!
g
.
state
.
editable
)
{
// Anything not editable is valid.
return
true
;
}
if
(
text_content
!==
null
)
{
if
(
text_content
.
value
===
""
)
{
// This would use standard value from getContent (which is valid).
return
true
;
}
doc
=
new
DOMParser
().
parseFromString
(
text_content
.
value
,
"
text/xml
"
);
if
(
doc
.
querySelector
(
'
parsererror
'
)
!==
null
)
{
return
false
;
}
return
true
;
}
return
g
.
getDeclaredGadget
(
'
json_form
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
checkValidity
();
});
});
});
}(
window
,
rJS
,
XMLSerializer
,
DOMParser
,
vkbeautify
,
domsugar
,
Boolean
,
URI
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment