Jump to content
UBot Underground

onchange in UI Panel is overwritten by ubot variable


Recommended Posts

Hello,

 

I have the following UI Panel code:

ui html panel("<!DOCTYPE html>
<html>
  <body>
    <div>
      <select  variable=\"#myvar2\" fillwith=\"value\" id=\"icd10\" onchange=\"doIt();\">
        <option value=\"United States\">United States</option>
        <option value=\"United Kingdom\">United Kingdom</option>
        <option value=\"Afghanistan\">Afghanistan</option>
      </select>
      <div id=\"hiddenIcd10\" variable=\"#myvar\" fillwith=\"innertext\"></div>
    </div>
    
  </body>
<script>
 
    function doIt()\{
        document.getElementById(\"hiddenIcd10\").innerText=document.getElementById(\"icd10\").value;
    \}
        
    </script>
</html>
", 135)

There is one select and one div, both with assigned variables.

 

The special thing here is that I have an event on the select that changes the innertext of the div. 

 

The result is that when the select changes, the div changes but only for a moment. Then ubot overwrites the value of the div blank.

 

Any ideas to overcome this would be very welcome.

 

Regards,

 

Jim

Link to post
Share on other sites

Ok, after I contacted support, Robert was very kind to give me the solution. Apparently, the value gets overwritten, that's a truth. The solution is to make my 'onchange' event trigger a ubot function that sets the "variable" param. 

 

I attach the fixed script.

 

jim

skata2 - fixed.ubot

Link to post
Share on other sites
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...