View previous topic :: View next topic |
Author |
Message |
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
Using submit button for TCPIP stack[SOLVED] |
Posted: Thu Feb 09, 2023 4:45 am |
|
|
Hello!
I have problems with sending button to webserver. It sends button value to server side but it send it forever.. One time shot what i want.
Can somebody found why it keeps repeating?
I'm using CCSC- tcpip stack and 18f67j60 CPU, PCWHD compiler 5.112
When i click this, it sends "tt1" but repeat it forever.
HTML side:
Code: |
<a><button id="tt1" class="btn_grn" onclick="sendCgi('tscr1','1')"><font size="6"><shad>%1e</shad><p><font size="10"><span id="dyn0"></span></p></button></a>
|
AJAX:
almost non modified (only part of)
Code: |
function UpdateExistingTable(xmlDoc)
{
var i=0;
for(;;)
{
var id = "dyn"+i;
i++;
if (document.getElementById(id))
document.getElementById(id).innerHTML = GetElementNodeValue(xmlDoc, id);
else
break;
}
dyn_0=document.getElementById("dyn0").textContent;
document.getElementById("tt0").innerHTML =dyn_0;
|
Last edited by -Terppa- on Fri Feb 10, 2023 8:05 am; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Thu Feb 09, 2023 7:21 am |
|
|
well I have never used any of that, and my knowledge of 'C' is small but...
this...
if (document.getElementById(id))
seems 'wrong'
I read it as
IF
the variable called 'document.getElementById(id))' contains ANYTHING
then
execute 'document.getElementById(id).innerHTML = GetElementNodeValue(xmlDoc, id); '
I'm probably wrong but to me anything inside the IF( some variable has a condition that is true )
needs a 'condition'.
What I read is 'If (there is a variable ) '...do something.
I know some may say ,the IF mean variable <>0, but to me 0 IS a valid value for a variable.... did a lot of 'negative' logic with 7400 chips back when dinosaurs roamed...so I don't assume ..... |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Thu Feb 09, 2023 9:15 am |
|
|
Thank you for your suggestion Mr. Temtronic.
I believe that (document.getElementById(id)) is correct. Because this line is not modified.
That AJAX module works very well and all values automatically updated in web page when it running.
And even so if i submit button variable in form POST/GET- method everything works like a charm. But if use that AJAX module and hit "send" button it send message forever.
If i reload web page it stops and get value in right place.
Hmm.. this is hard to explain. |
|
|
-Terppa-
Joined: 08 Jan 2018 Posts: 59 Location: Finland
|
|
Posted: Fri Feb 10, 2023 8:05 am |
|
|
Now it is fixed
Very hard to found that bug because there is lot of code and different type of files ".XML, .JS, .HTM and so on"
Hours and hours testing and debugging there was bug in one dynamic value in inventory and that causes none of them values doesen't work at all and keeps repeating same command to backend service..
These values work if i send whole form at time but it also reload webpage again and i don't want that happened.
Small bug but.. How much work.. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Fri Feb 10, 2023 8:33 am |
|
|
That's GREAT news !! Sounds like it needed 4 or 5 coffee pots, but you FOUND it !! |
|
|
|