summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-06-10 22:22:06 +0200
committerGitHub <noreply@github.com>2020-06-10 22:22:06 +0200
commitf20fafb7a57d61489d13885fa91ea7b56eb39636 (patch)
tree2763f0b8213ee63531c98556b7f79ae081a6c6c8
parent44d145a85f2881bd89dfc53479312c88ebb23aba (diff)
parent151ca6df558035e40a460fef15d0cb1301fac5be (diff)
Merge pull request #4157 from Ansuel/fixddns
luci-app-ddns: Fix broken Custom provider select #4150
-rw-r--r--applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js35
1 files changed, 32 insertions, 3 deletions
diff --git a/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js b/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js
index a15563e5b..2bda3f3bc 100644
--- a/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js
+++ b/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js
@@ -511,7 +511,14 @@ return view.extend({
o.value('-',"-- " + _("custom") + " --");
o.cfgvalue = function(section_id) {
- return uci.get('ddns', section_id, 'service_name');
+ var service = uci.get('ddns', section_id, 'service_name'),
+ update_script = uci.get('ddns', section_id, 'update_script'),
+ update_url = uci.get('ddns', section_id, 'update_url');
+
+ if (!service && (update_script || update_url))
+ return "-";
+
+ return service;
}
o.write = function(section_id, formvalue) {
@@ -529,19 +536,41 @@ return view.extend({
_("Update URL to be used for updating your DDNS Provider." + "<br />" +
"Follow instructions you will find on their WEB page."));
o.modalonly = true;
- o.rmempty = false;
+ o.rmempty = true;
+ o.optional = true;
o.depends("ipv6_service_name","-");
o.depends("ipv4_service_name","-");
+ o.validate = function(section_id, value) {
+ var other = this.section.children.filter(function(o) { return o.option == 'update_script' })[0].formvalue(section_id);
+
+ if ((value == "" && other == "") || (value != "" && other != "")) {
+ return _("Insert a Update Script OR a Update URL");
+ }
+
+ return true;
+ }
+
// update_script
o = s.taboption('basic', form.Value, 'update_script', _("Custom update-script"),
_("Custom update script to be used for updating your DDNS Provider."));
o.modalonly = true;
- o.rmempty = false;
+ o.rmempty = true;
+ o.optional = true;
o.depends("ipv6_service_name","-");
o.depends("ipv4_service_name","-");
+ o.validate = function(section_id, value) {
+ var other = this.section.children.filter(function(o) { return o.option == 'update_url' })[0].formvalue(section_id);
+
+ if ((value == "" && other == "") || (value != "" && other != "")) {
+ return _("Insert a Update Script OR a Update URL");
+ }
+
+ return true;
+ }
+
// domain
o = s.taboption('basic', form.Value, 'domain', _("Domain"),