CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Using submit button for TCPIP stack[SOLVED]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
-Terppa-



Joined: 08 Jan 2018
Posts: 59
Location: Finland

View user's profile Send private message

Using submit button for TCPIP stack[SOLVED]
PostPosted: Thu Feb 09, 2023 4:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Feb 09, 2023 7:21 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Feb 09, 2023 9:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 10, 2023 8:05 am     Reply with quote

Now it is fixed Very Happy

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

View user's profile Send private message

PostPosted: Fri Feb 10, 2023 8:33 am     Reply with quote

That's GREAT news !! Sounds like it needed 4 or 5 coffee pots, but you FOUND it !!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group