function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rawiswarrawiswar 

weird javascript

not sure if anyone's been affected by this badly but I seem to notice that javascript and DOM have lots of problems when used within VF. is there something I am missing? IF anyone's interested I could give you some examples.
aalbertaalbert
Have you read the section on "Using JavaScript in Visualforce Pages" in the Developer's Guide: http://www.salesforce.com/us/developer/docs/pages/index.htm? Might help.


rawiswarrawiswar
Albert,
I have and it does not give me what I am looking for. I mean simple JS. It mentions cross-browser compatibility problem. I am not even going that far. Anyway, let me try something out. I was looking for replies that mentioned actual incidents and solutions. That way I might learn something. Reading has not helped me so far. Thanks
RyanGuestRyanGuest
Could you give some examples of the Javascript problems you are seeing?
rawiswarrawiswar
Code:
<script>        
        while(null){
        
         }
        document.getElementById("mySOAFrame").src="{!sessId}";     
</script>

 consider the above code:: the variable sessId is currently set to a valid web address.
1. why would the page not load up when the while loop is taken out?
2. the dom statement actually retrieves the intended frame BUT firebug shows 4 errors.

As an aside, I tried a similar dom retrieval sometime earlier on a different page which did not work.
RyanGuestRyanGuest
So it looks like you're trying to dynamically set the src of an iframe called "mySOAFrame" from a Visualforce page? This looks like a generic Javascript issue, I'll try it out from one of my pages and see what works.
rawiswarrawiswar
but the only issue is this typical code when not using inside sf .... otherwise, i could say i am doing something crazy
apart from that, my main concern is why do I need that while loop?


Message Edited by rawiswar on 01-09-2009 02:28 PM
RyanGuestRyanGuest
What you described is very weird. I can't seem to reproduce the problem. Can you provide more info? (what browser are you using, include some Visualforce code).
rawiswarrawiswar
Try experimenting with the code I have given here for instance. I use Firefox 3. Defies all logic ---

Code:
<apex:page controller="generator">
<apex:pageBlock >
<apex:iframe id="myFrame" scrolling="true"/>
<script>        
        while(null){
        
         }
        document.getElementById("myFrame").src="{!sessId}";     
</script>


</apex:pageBlock>
</apex:page>

 


Message Edited by rawiswar on 01-16-2009 10:43 AM
RyanGuestRyanGuest
Code:
public class generator {

    public String getSessId() {
        return UserInfo.getSessionId();
    }

}

 

I used your VisualForce page with the Apex class above and I got this error page in an iframe with and without the while(null) loop.


Page 000100DD0000000F7Rf!ARkAQKDfKbWwkuT08bUcuwBpLppcec000XrYYkUKAvXi3Hj00r2B.lzCd8p4ha9ZJ2ZqI33G0zWi5sdbGlHcqR6R1yFG0000 does not exist.


Is this what you see? What is different?

rawiswarrawiswar
why should I even need the while loop?
also, I am getting other errors (on firebug) but those do not really affect functionality. it bugs me though to know that