Author Topic: User panel DNS Zone Editor: cannot add/edit A/AAAA records - backend rejects wit  (Read 13 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Version: [fill in, e.g. CWP7 1.x - see admin panel footer]
OS: [e.g. AlmaLinux 9.8]

Repro:
1. User panel > DNS Functions > DNS Zone Editor
2. Select any domain
3. Add Type Record > A
4. Fill Name + IPv4 + TTL > Save record
5. Fails every time with: "Your DNS zone is experiencing errors,
   your DNS service has not been update!"

Root cause:
File cwp_theme/original/js/modules/dns_zone_editor.js.twig,
validform() generic branch (used for A/AAAA records). It reads
$("#flag_"+reg).val() / $("#tag_"+reg).val(), but modal-A /
modal-AAAA in modal_tools.html have no flag/tag inputs (those are
CAA-only fields). The missing elements yield JS undefined, so the
request is sent as ...&reg=A&flag=undefined&tag=undefined.
The backend replies {"result":"error","msj":"invalid field: flag"}
(captured via syscall trace on the php-fpm worker), which the UI
renders as the DNSZONEOFF error. So ALL A/AAAA adds and edits from
the user panel are broken regardless of input.

Suggested fix:
In the generic branch, do not send flag/tag for record types that
have no such fields (A/AAAA) - same as the CNAME/SRV branches
already handle their own params. One-line change, verified working:

  var data = "domain="+domainsel+"&namereg="+namereg+"&valuereg="
             +valuereg+"&cachereg="+cachereg+"&reg="+reg;