• mejoe
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

I need to implement a visualforce page that serves a javascript text file.  This is based on this blog entry: http://www.nimbleuser.com/blogs/Developers/Developers/Visualforce_Static_Resource_Alternative.aspx

 

<apex:page contentType="text/javascript" cache="false" expires="0">
//alert('ping');
if (document.getElementById('cas21') != null)
 {
    var divsInthepage = document.getElementsByTagName("DIV");
    for (i = 40; i < divsInthepage.length; i++)
    {

        if (divsInthepage[i].innerHTML.indexOf("topButtonRow", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = '&lt;table  border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt;&lt;td class="pbTitle"&gt;&lt;img src="/s.gif" alt="" width="1" height="1" class="minWidth" title="" /&gt;&lt;h2 class="mainTitle"&gt;Case Edit&lt;/h2&gt;&lt;/td&gt;&lt;td class="pbButton" id="topButtonRow"&gt;&lt;input value="Submit"  class="btn" title="Submit" name="save" type="submit" /&gt; &lt;input value="Cancel"  class="btn" title="Cancel" name="cancel" type="submit" /&gt;&lt;/td&gt;'
        }
        if (divsInthepage[i].innerHTML.indexOf("bottomButtonRow", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = '&lt;table  border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt;&lt;td class="pbTitle"&gt;&lt;img src="/s.gif" alt="" width="1" height="1" class="minWidth" title="" /&gt;&lt;/td&gt;&lt;td class="pbButtonb" id="bottomButtonRow"&gt;&lt;input value="Submit"  class="btn" name="save" tabindex="11" title="Submit" type="submit" /&gt; &lt;input value="Cancel"  class="btn" name="cancel" title="Cancel" type="submit" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;'
        }
        if (divsInthepage[i].innerHTML.indexOf("Assign using active assignment rules", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = '&lt;table  class="detailList" border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr  class="detailRow last"&gt;&lt;td colspan="4"&gt;&lt;input  checked="checked" id="cas21" name="cas21" tabindex="10" type="checkbox" value="1" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;'
        }
        if (divsInthepage[i].innerHTML.indexOf("&lt;h3&gt;Optional&lt;span", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = ''
        } {
    }
}
</apex:page>

It seems that any occurence of "<" or "&" is triggering the issue. I discovered that setting the version number for the file to 18 fixed the issue.  What can I do to format the javascript so that it does not cause validation errors?

  • October 10, 2011
  • Like
  • 0

I need to implement a visualforce page that serves a javascript text file.  This is based on this blog entry: http://www.nimbleuser.com/blogs/Developers/Developers/Visualforce_Static_Resource_Alternative.aspx

 

<apex:page contentType="text/javascript" cache="false" expires="0">
//alert('ping');
if (document.getElementById('cas21') != null)
 {
    var divsInthepage = document.getElementsByTagName("DIV");
    for (i = 40; i < divsInthepage.length; i++)
    {

        if (divsInthepage[i].innerHTML.indexOf("topButtonRow", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = '&lt;table  border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt;&lt;td class="pbTitle"&gt;&lt;img src="/s.gif" alt="" width="1" height="1" class="minWidth" title="" /&gt;&lt;h2 class="mainTitle"&gt;Case Edit&lt;/h2&gt;&lt;/td&gt;&lt;td class="pbButton" id="topButtonRow"&gt;&lt;input value="Submit"  class="btn" title="Submit" name="save" type="submit" /&gt; &lt;input value="Cancel"  class="btn" title="Cancel" name="cancel" type="submit" /&gt;&lt;/td&gt;'
        }
        if (divsInthepage[i].innerHTML.indexOf("bottomButtonRow", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = '&lt;table  border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt;&lt;td class="pbTitle"&gt;&lt;img src="/s.gif" alt="" width="1" height="1" class="minWidth" title="" /&gt;&lt;/td&gt;&lt;td class="pbButtonb" id="bottomButtonRow"&gt;&lt;input value="Submit"  class="btn" name="save" tabindex="11" title="Submit" type="submit" /&gt; &lt;input value="Cancel"  class="btn" name="cancel" title="Cancel" type="submit" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;'
        }
        if (divsInthepage[i].innerHTML.indexOf("Assign using active assignment rules", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = '&lt;table  class="detailList" border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr  class="detailRow last"&gt;&lt;td colspan="4"&gt;&lt;input  checked="checked" id="cas21" name="cas21" tabindex="10" type="checkbox" value="1" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;'
        }
        if (divsInthepage[i].innerHTML.indexOf("&lt;h3&gt;Optional&lt;span", 1) > 1 && divsInthepage[i].innerHTML.indexOf("requiredBlock", 0) < 1)
        {
            divsInthepage[i].innerHTML = ''
        } {
    }
}
</apex:page>

It seems that any occurence of "<" or "&" is triggering the issue. I discovered that setting the version number for the file to 18 fixed the issue.  What can I do to format the javascript so that it does not cause validation errors?

  • October 10, 2011
  • Like
  • 0

So we have a visualforce page which has a standard Apex button which calls the native "Save" event. After the users save the "form" so to speak, they are taken to another page which is an overview of what they just did with the options to edit or submit (which triggers an email to an internal department)

 

 

Since our sales reps aren't the brightest bunch, they would like a "pop up" to remind them to submit after they have saved. So in actullity im just looking to attach a JavaScirpt listener to that button that when its clicked, the save event is still initiated but there is a pop up which just displays a message stating "Please do not forget to submit after saving". Its almost like a confirm popup but i dont know if i can attach an apex command to the confirmation.

 

 

Does anyone have any help or advice on this one? i can post a little bit of the Visualforce page if needed. Any help is appreciated.

 

Thanks,

Dan

Hi All,

 

This is a repost of a question which went unanswered in the 'General Developments' thread.  Would be grateful for feedback and shared experiences.

 

I'm looking at best practice suggestions for collaborative development in Force.com.  I'm working on a project which is scaling up from a single developer to several. 

 

Ideally I'd like us to work in seperate sandboxes, merge and deploy to a single pre-release sandbox, test, tag and deploy from there.  I'm considering using local version control via the IDE and forcing state changes in the cloud through forced 'save to server's. 

 

A couple of questions:

 

i) How do others handle collaboration and versioning?

ii) Can one version state of non-programmatic constructs (ie. custom objects, etc)?

iii) Is there someway of cloning the state of my sandbox directly into that of another developer's sandbox?

 

Any thoughts / suggestions / lesson-from-the-field would be valuable.

 

Thanks,

 

R.

 

  • September 01, 2009
  • Like
  • 0