Code Block execution |
Post Reply | Page <12 |
Author | |
uzes90
Newbie Joined: Mar 31 2019 Location: NYC Status: Offline Points: 18 |
Post Options
Thanks(0)
|
Don't see how that would matter as there's the basic issue of the code not being executed "on click". It's executed when the page loads and that's it. But, I made the change and added "select"... no difference. Is there some documentation or tutorial on executing code blocks? I know I'm a newbi to this app but I have much experience coding etc. and this just doesn't make sense to me. I'm missing something... or its just not doable. I do appreciate your time trying to help me.
|
|
Hobby001
Admin Group Joined: Jun 05 2018 Location: Canada, Québec Status: Offline Points: 6209 |
Post Options
Thanks(0)
|
Sorry, my mistake, I'm about to leave for more than a week therefore I'm trying to do everything in the same time
I used:
On this page and it work fine for me. Edited by Hobby001 - Mar 31 2019 at 10:34pm |
|
uzes90
Newbie Joined: Mar 31 2019 Location: NYC Status: Offline Points: 18 |
Post Options
Thanks(0)
|
Sorry, doesn't work for me. But perhaps "works" is in the eye of the beholder. It will change pages for me depending on which drop-down I click. But it won't do this on the button-click of a button object on the same page as the drop down. An explanation of where the "code block" is calledd would really help. Thanks
|
|
brolysan
Admin Group Joined: Aug 05 2016 Status: Offline Points: 2128 |
Post Options
Thanks(0)
|
The code can be adapted to your needs, but remember, Hobby001 is also a volunteer (like all of us). Thank you
|
|
http://sensode.com
|
|
uzes90
Newbie Joined: Mar 31 2019 Location: NYC Status: Offline Points: 18 |
Post Options
Thanks(0)
|
Hi- Of course I understand he's a volunteer, and I appreciate all the help he's provided. And openElement seems to be a great app that I was able to use very nicely so far. I like it. Yet... I keep asking the same question... how to use code-block... and no one is able to give me an answer. I wish I could get an explanation on how a code block gets called. The closest I've been able to get is that it can be called from a button object by going to the Link Configuration section, choosing "JS:" in the drop down instead of chosing a link, and then adding the name of my code block. However, on execution I get an error saying it can't find the reference to my code block. Again, thank you all for your help. |
|
Hobby001
Admin Group Joined: Jun 05 2018 Location: Canada, Québec Status: Offline Points: 6209 |
Post Options
Thanks(1)
|
Sometime it's harder to understand the question than to answer it.
I added the following function called OpenHomePage to a javascript source code:
Then linked it to your button by writing the function's name to it. Edited by Hobby001 - Apr 01 2019 at 1:29pm |
|
uzes90
Newbie Joined: Mar 31 2019 Location: NYC Status: Offline Points: 18 |
Post Options
Thanks(1)
|
Hi- Thanks for the clear example. I did exactly as you said... and IT WORKED ! I traced my last error back to a missing semi-colon in the JS: definition. I'm on my way... Thanks for all your help !!! Edited by uzes90 - Apr 02 2019 at 2:33pm |
|
uzes90
Newbie Joined: Mar 31 2019 Location: NYC Status: Offline Points: 18 |
Post Options
Thanks(0)
|
Hi All, I thought I would continue this thread as a sort of tutorial. The Admins can move it there if they see fit. I spent a lot of time getting this stuff to work with the help of the Hobby001. I’d like to try and give something back. I learned quite a bit about how to do things in a code-block –
The code-block is supposed to get a value from a drop-down list and call a corresponding web page if the input field or password is valid. Note that in the example below, I don’t check for a password (myInputField) for the secondd drop-down element. Initial version of the code block: function gotoMyCodeBlock(){ if ( $('myDropDownList select').val()=='1' && $('myInputField’).val() =='1') { window.location = 'situation1.htm'; } else if ( $('myDropDownList select').val()=='2') { window.location = 'situation2.htm'; } else { window.location = 'page25.htm'; } }
I learned that I could not use my fieldnames and needed to use the code ID’s, i.e. “WE” field names. Then, to get input from “myInputField”, JavaScript needed the “input” parameter. Finally, to switch to a new web-page, the “windows.location=<page name> worked fine in “Preview” mode. But when I transferred it to the actual web-server, I kept getting 404 errors. To get around this I could specify the entire page address, i.e. c:\aaa\bbb\www\page25.htm. But then I found that this trick would work - OE.Navigate.open(event,'situation2.htm',1).
Final version of the code: function gotoMyCodeBlock (){if ( $('#WE9d9b5e5188 select').val()=='1' && $('#WE3ba56be448 input').val() =='1') { OE.Navigate.open(event,'situation1.htm',1) } else if ( $('#WE9d9b5e5188 select').val()=='2') { OE.Navigate.open(event,'situation2.htm',1) } else { OE.Navigate.open(event,'page25.htm',1) } } HTH, uzes90 |
|
Post Reply | Page <12 |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |