I have a page that's returning several formVars twice. Specifically in request.aFormvar() - lcFormVars = lcDataBuffer :
------geckoformboundaryfb282d2cbd2281d1ac76cf6faff5b248
Content-Disposition: form-data; name="chkkommpersletzte"
on
------geckoformboundaryfb282d2cbd2281d1ac76cf6faff5b248
Content-Disposition: form-data; name="chkkommterminmail"
on
------geckoformboundaryfb282d2cbd2281d1ac76cf6faff5b248
Content-Disposition: form-data; name="chkallk05ziel"
on
------geckoformboundaryfb282d2cbd2281d1ac76cf6faff5b248
Content-Disposition: form-data; name="chkallk05ziel"
ON
------geckoformboundaryfb282d2cbd2281d1ac76cf6faff5b248
Content-Disposition: form-data; name="hidallk06"
,5309,5481,5482,5501,5531,5539,5562,5564,5568,
You see "chkallk05ziel" is twice, the other not. "chkallk05ziel" is only defined once! You have an idea ?

Well it's in the post data twice, so the value is getting sent from the client twice. Are you sure you don't have a second control with the same name or a control that has multiselect
set? See the actual generated HTML output. Do a View Source and search the code with Find in the source view.
+++ Rick ---
Yes, i'm sure, i don't have a second control with the same name and the control don't has multiselect set, it is a normal checkBox:
<th class="text-center"><input type="checkbox" name="allk05ziel" class="form-check-input">Ziel</th>
<th class="text-center">Gutachter</th>
Look at the generated HTML in the document and do a search for the name. Pretty sure you will find it exists more than once.
Otherwise the browser wouldn't be posting it multiple times. Also look in the browser tools at the actual POST data that is being sent. Is the POST value in there twice?
+++ Rick ---

I checked it in 2 different ways,
with the browser tools:
and the request viewer webConnection - full http Response
It is only defined once, i agree with your logic, but I can't find anything what solves this problem
Well, if the browser is sending two variables of that name, then it thinks there are two of those items in the page. And if it there's not then there's a Web browser bug and there's nothing we can do about that other than ignore the second value. Try a different browser too to see if that behaves differently.
The search you're doing in the browser tools is looking for the ID (#
). Look for the NAME as that's what's submitting. If you're using generated code it's possible there's a secondary value getting set. Are you using the Web Control framework or the MVC helpers? In that case don't set the name
manually - checkboxes use a backing field to hold the actual value and I bet that's where that second value is coming from.
Literally look for the name="allk05ziel"
.
+++ Rick ---
Well, i have tried three different browser too to see if that behaves differently, each browser has the same result. Then i have deleted all the code around this checkbox, who has nothing to do with this checkbox, the same result. I don't use MVC helpers. At the moment i will write a method which ignore the second value and then start further attempts to understand this behavior.
Ok ... i have the solution. I use https://cloudtables.com/examples/buttons as framework. A script file is also integrated, which forces the behavior of the checkbox. I will contact Cloud's support and describe the problem. If you are interested, I can inform you about the result
Yes please. But I think the problem likely is that you are explicitly setting the name
when it's generating a code behind field on the fly. I think frameworks like this (Web Connection Framework did this too) should set the id
only and the let frramework manage the name which is actually set on a separate field to handle the null state (unset) of checkboxes and radio buttons.
Depends on the framework though... that's why I say: Check the actual source code and search for the exact string not some CSS query...
+++ Rick ---
Hi ... an interim report about what I found I built a page with just one checkbox and the necessary scripts
<!DOCTYPE html>
<html lang="de">
<head>
<script src="scripts/jquery-3.7.1.js"></script>
<script src="scripts/datatables.js"></script>
<script src="scripts/moment-2.30.1.min.js"></script>
</head>
<body>
<form id="form1" name="form1" method="post" action="..." target="_self">
<main>
<table class="display">
<thead><tr><th>
<input type="checkbox" name="allk05ziel" id="allk05ziel">Ziel</th></tr>
</thead>
</table>
</main>
</form>
<script src="scripts/listen/1/inetScriptk01.js"></script>
</body>
</html>
The result is twice Checkboxes:
The reason is the external script file "inetScriptk01.js":
$.extend($.fn.dataTable.defaults, {
scrollX: true,
.....
});
$('table.display').dataTable();
When I put the last line to the beginning, everything is fine
$('table.display').dataTable();
$.extend($.fn.dataTable.defaults, {
scrollX: true,
});
I contact the support of Cloudtabels and wait for an answer
Now i have a response from support of Cloudtabels: "When using scrolling features Datatables clones the header and hides the original to help facilitate scrolling. Without the CSS you see both the cloned and original."
They send me a CSS-File that I should also use.