Webdialog problem
-
Sometimes an uncaught JS exception can silently kill the works. Surround all your JS code with try{} catch{} blocks and see what happens.
-
Todd is right. Haven't thought of that...
If it's possible, you should debug the JS separately with the error pane in Firefox (or FireBug plugin, if you so fancy).
That will help focusing on the problem.- Tali
-
If you don't mind me repeating, if you are using a webdialog do as much as possible in its html file.
I also suggest you generate html using something like this:
for(a=0; a<abcdArray.length; a++){ obj=document.createElement(tagname) document.getDocumentById(parentId).appendChild(obj) with(obj){ innerHTML = abcdArray[a] with(style){ ... } } }
If still troublesome you can use
try .. catch(e)
to find which iteration causes the problem.As far as possible just use ruby for the connection (e.g. opening the dialog) and any action in the SU interface.
Hope this helps,
Chris
-
Talig,
In the code for the dynamic link that you're generating, are you using a "#" as the href? If so, try changing it to "javascript:;" and see if that helps. For example, if you have something like this...
<a href="#" onclick="doSomething()">Link</a>
Change it to this...
<a href="javascript:;" onclick="doSomething()">Link</a>
Or even better, get rid of the link entirely...
<span onclick="doSomething()">Link</span>
I've seen a problem similar to what you're describing that was caused by something like the above.
Cheers,
-
@unknownuser said:
Talig,
In the code for the dynamic link that you're generating, are you using a "#" as the href? If so, try changing it to "javascript:;" and see if that helps. For example, if you have something like this...
<a href="#" onclick="doSomething()">Link</a>
Change it to this...
<a href="javascript:;" onclick="doSomething()">Link</a>
Or even better, get rid of the link entirely...
<span onclick="doSomething()">Link</span>
I've seen a problem similar to what you're describing that was caused by something like the above.
Cheers,
Or, make sure the onclick() event returns false. That will prevent the website from trying to follow the URL in the HREF.
-
Scott,
I'm not the one who posted the question- Tali
-
Hey all, thanks for the support and answers.
I have made a workarround by just generating and regenerating my html script all from in ruby itself.
So there is no external html file used anymore. This off course is not the best way (like chris says it's better to do all in html) but for now, it will do. I'll see if i can solve this in the near future. It it to be expected that the way i use now is slower or less stable?Scott, the href contains javascript:doSomething();
Maybe if i drop the href and use the span it will solve.
I'll keep you posted once i get into this again.Regards and thanks!
-
@pout said:
I have made a workarround by just generating and regenerating my html script all from in ruby itself.
So there is no external html file used anymore. This off course is not the best way (like chris says it's better to do all in html) but for now, it will do.I dunno, the advantage is that your script install has fewer files. Unless you're regenerating an extremely large set of HTML or doing it a lot, I think you'd be fine with that approach.
@unknownuser said:
Scott, the href contains javascript:doSomething();
Maybe if i drop the href and use the span it will solve.
I'll keep you posted once i get into this again.In that case, I think that if doSomething() returns false, as Thom suggested, then the problem should go away. Sounds like you found a solution in any case!
Cheers,
-
on the first point: the set of html is indeed not so small and it is regenerated a lot of times
so in the near future i intend to try getting as much as possible back into the external html again.I'll keep you posted on progress.
Thx! -
As you know I am keen to promote the use of webdialogs. One significant reason is that html files can contain links to the world. Afterall we are told by such gurus as Kevin Kelly and Tim Berners-Lee that data linking is the future of the World Wide Web.
@pout said:
on the first point: the set of html is indeed not so small and it is regenerated a lot of times
So I want to post this:
Mechanisms should not be designed to suit the size of the current task. They should be made for types of tasks to be reusable with different variables and conditions. Then you and any collaborators will appreciate their existence in the future. Using html markup in quotes in either ruby or javascript files is contrary to this approach. Using tables for layout should be avoided.
If you like I am willing to help you do it this way but you will need to show more of what you have achieved so far.
Chris
Advertisement