Ewon Technical Forum

Full Version: javascript on text input
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?