onHtmlChange update value only on first pass

Here we can discuss about the problem found
Post Reply
TRS80_MKI
Posts: 21
Joined: Sun Apr 18, 2021 3:38 pm
Has thanked: 11 times
Been thanked: 5 times

onHtmlChange update value only on first pass

Post by TRS80_MKI »

Hi ,
i have a strange bahaviour inside onHtmlChange
check the value of Pict. To Do , must be between 0 and 255 .
first time input value is - 1 --> HTML update is 1 :: OK
second time input value is -2 --> HTML update is -2 :: KO
third time input value is 259--> HTML update is 255 :: OK
fourth input value is 280-> HTML update is 280 :: KO
fith input value is - 1 --> HTML update is 1 :: OK
it's seem the update of HTML is only valide one time for the same condtion.
if i use the condition several time .. no update of value in the HML .
I said "weird, weird"... how strange! (« Drôle de drame » 1937) :lol:
the html page :
image.png
the code inside the event :
image.png
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: onHtmlChange update value only on first pass

Post by cicciocb »

Try to remove elseif and use only if then else or select case
TRS80_MKI
Posts: 21
Joined: Sun Apr 18, 2021 3:38 pm
Has thanked: 11 times
Been thanked: 5 times

Re: onHtmlChange update value only on first pass

Post by TRS80_MKI »

Hi ,
thanks for your suggestion .
Changed the code , but same result .

Cause a lot of code in the event i move it outside onHtmlChange .

I used MQTT to run the code outside onHtmlChange .
MQTT Broker active , subscribe to a topic "/event" , and i publish topic "/event" from onHtmlChange.

ONMQTT event call a SUB wich contain all logic for onHtmlChange .. simple ? but no subscribe is catched from MQTTBROKER .
if i publish topic "/event" from node-red : OK , MQTTBROKER catch it (in esp32) ,
but if i publish topic "/event" from onHtmlChange node-red catch it but not esp32!

Any idea ? ;)
i will try with a kiss example ..

@+
TRS90_MKI
User avatar
cicciocb
Site Admin
Posts: 2781
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 592 times
Been thanked: 1990 times
Contact:

Re: onHtmlChange update value only on first pass

Post by cicciocb »

HI, I think you must clarify a little bit as it is not really clear, at least for me.

Try to put a little snippet ....
Post Reply