.execute_script interesting quirk
-
I thought this experience would be worth sharing in case anyone else gets stuck like i did~
So i don't know if this qualifies as a "bug" per say...but it definitely made my morning long and frustrating.
Has any one else noticed that if you create an action_callback through clicking on a <a href...> tag instead of a button, the .execute script command no longer works on the web_dialog parameter. Correct me if Im wrong but I spent all morning testing this problem with two cal_backs that were essentially identical. It took me several hours to realize that the only difference was one got created through a button, and the other through a hyperlink
everything else I worked in the callback except for .execute_script for the record
(I was just using hyper-links because the buttons were so ugly)
It would be interesting to see if other methods of creating a call_back in a webdialog have this bug.
cheers
Korbin*Update I did a quick test on a callback created through clicking on an image I have in my app, and it worked fine...verrrrry interesting
-
I have several custom tools using href button with rounded ends etc instead of standard buttons - this way [you define the button class in your css style code] - the call_backs work fine - here's a snippet...
<span class="syntaxdefault"><br /></span><span class="syntaxkeyword"><</span><span class="syntaxdefault">td align</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">center style</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"width;84px; padding;3px;"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">a id</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"cancel_dropdown"</span><span class="syntaxdefault"> <br /> class</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"button"</span><span class="syntaxdefault"> href</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"#"</span><span class="syntaxdefault"> <br /> onclick</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"this.blur(); window.location='skp;cancel_dropdown@';"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">></span><span class="syntaxdefault">Cancel</span><span class="syntaxkeyword"></</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"></</span><span class="syntaxdefault">a</span><span class="syntaxkeyword">><br /></</span><span class="syntaxdefault">td</span><span class="syntaxkeyword">></span><span class="syntaxdefault"> </span> -
@tig said:
I have several custom tools using href button with rounded ends etc instead of standard buttons - this way [you define the button class in your css style code] - the call_backs work fine - here's a snippet...
<span class="syntaxdefault"><br /></span><span class="syntaxkeyword"><</span><span class="syntaxdefault">td align</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">center style</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"width;84px; padding;3px;"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">a id</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"cancel_dropdown"</span><span class="syntaxdefault"> <br /> class</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"button"</span><span class="syntaxdefault"> href</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"#"</span><span class="syntaxdefault"> <br /> onclick</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"this.blur(); window.location='skp;cancel_dropdown@';"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">></span><span class="syntaxdefault">Cancel</span><span class="syntaxkeyword"></</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword"></</span><span class="syntaxdefault">a</span><span class="syntaxkeyword">><br /></</span><span class="syntaxdefault">td</span><span class="syntaxkeyword">></span><span class="syntaxdefault"> </span>even the .execute_script command? everything else works for me too except for that....although looking at your code it may be because i used:
<a href="javascript:AddChangeDiagnosis()" ><b>[Add/Change]</b></a>
to call the function, whereas both my buttons and the image i click use the "onclick" attribute
** confirmed....that was the problem, sooo take home lesson...always use "onclick" !
-
@kdasilva said:
(I was just using hyper-links because the buttons were so ugly)
Put this meta-tag in the <HEAD> section of the webdialog html:
<span class="syntaxdefault"></span><span class="syntaxkeyword"><!--</span><span class="syntaxdefault"> This tells the HTML frame to use MS Common Controls ver 6</span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">--><br /><!--</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">also known as XP style themed controls</span><span class="syntaxkeyword">.)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">--><br /><</span><span class="syntaxdefault">META HTTP</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">EQUIV</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"MSThemeCompatible"</span><span class="syntaxdefault"> CONTENT</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"Yes"</span><span class="syntaxkeyword">></span><span class="syntaxdefault"> </span> -
I've not seen such quirk you mention. I suspect it might be some other JS error perhaps...?
-
I think there is a whole topic on this concerning "Javascript:void(0);" vs "Javascript:return;" one of which needs to be in the HREF tag, the Ruby callback needs to be in the onClick call.
-
@dan rathbun said:
I think there is a whole topic on this concerning "Javascript:void(0);" vs "Javascript:return;" one of which needs to be in the HREF tag, the Ruby callback needs to be in the onClick call.
To avoid triggering an A HREF link, and instead execute some other JS code, you return false to the onclick event.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement