Switch to desktop version  
javascript on text input - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: Custom Web Pages/viewON/Talk2M Visualization (https://techforum.ewon.biz/forum-55.html)
+--- Thread: javascript on text input (/thread-803.html)



javascript on text input - AngelaT - 07-01-2019

I've run into an issue and I'm hoping someone else has hit it too and has come up with a good workaround.

I have a text field on my viewON page.  The actions available for a text field are a little limited - I can either put the contents into a string tag on my eWON or I can run a BASIC script.  I would like to run some javascript instead.  Right now, after I export my viewON project to my eWON, I edit the resulting .shtm file and replace

"UID_NoteContainer":[{"type":"sendString","tag":"BASICscript","sendType":"script","events":[{"event":"change"}]}]

with 

"UID_NoteContainer":[{"type":"executeJS","method":/**Start of Execute JS Action of group element.**/function(id) {my javascript here;}/**End of Execute JS Action of group element.**/,"events":[{"event":"change"}]}]

in the actionConfig string. It works fine.  However, I'd REALLY like to skip having to manually edit the .shtm file and re-export it every time I make a change to my project.  

I feel like there should be a way to run a script when the page loads to update the actionConfig string, but my javascript skills are too limited.  Can anyone help me out?