Stat Tracker

Thursday, April 7, 2011

Visualforce Inline Editing - IE Error - Fix

Salesforce released inline editing in Spring 11 for Visualforce pages, which is pretty sweet. Especially considering when you need to replace a standard detail page with a VF page to do some secret sauce awesomeness, this was one feature which roadblocked it many times. It couldn't be simpler to implement, for example:

<apex:page standardController="CustomObjectABC__c" extensions="SecretSauceController" >
     <apex:form>
     <apex:detail inlineedit="true">
     </apex:detail>
    <apex:pageBlock title="Secret Sauce Functionality!!!!" >
        <apex:pageBlockButtons >
            <apex:commandButton value="Execute The Awesome" action="{!awesomeMethod}" rendered="{!isUserAwesome}"/>
        </apex:pageBlockButtons>
        <apex:outputText value={!howAwesomeIsUser}/>
    </apex:pageBlock>
    <apex:form>
</apex:page>


So whats the problem? Nothing if you use a decent browser like Firefox or Chrome.

But what about IE?

Well, if you have some <apex:commandButton>'s on the page, the buttons won't work and you will get a javascript error like this:

IE Mesage: 'document.forms.echoScontrolForm_066700000004hqK' is null or not an object

And now your custom code won't execute! Yeah, this frustrated me big time, but I found a work around by playing around with the page for about an hour. The issue is how Force.com platform is handling the forms. If you wrap each piece in its own <apex:form> with their own ids your good. So using the above example, if you do this it will work:

<apex:page standardController="CustomObjectABC__c" extensions="SecretSauceController" >
     <apex:form id="detailForm1">

     <apex:detail inlineedit="true">
     </apex:detail>
     </apex:form>
     <apex:form id="detailForm2">
    <apex:pageBlock title="Secret Sauce Functionality!!!!" >
        <apex:pageBlockButtons >
            <apex:commandButton value="Execute The Awesome" action="{!awesomeMethod}" rendered="{!isUserAwesome}"/>
        </apex:pageBlockButtons>
        <apex:outputText value={!howAwesomeIsUser}/>

    </apex:pageBlock>
    <apex:form>

</apex:page>

It should be noted that this is a known issue and that Salesforce is working on a fix that is scheduled to be released in the upcoming Summer 11 release. Until then, if you can't wait for inline editing (and why would you?) you can use the above fix.

I mean basically I hope the goal is to give VF all the feature of standard detail pages. Its still not quite there yet, some things you just can't get. But they are getting there.

Man, all this secret sauce code has me craving a Big Mac...... MMMMMM.......Heart Attackalicious.....

http://boards.developerforce.com/t5/Visualforce-Development/lt-apex-form-gt-tag-and-inline-editing-break-googlemaps-packaged/m-p/265569#M34264

Tuesday, April 5, 2011

Salesforce ERD Tool Review - ERD Tool by Xactium

I just saw a twitter feed about a new ERD tool which is available in preview called "ERD Tool" which is provided for free by Peter Gascoyne and Xactium. 

You can get to the AppExchange listing here: https://sites.secure.force.com/appexchange/listingDetail?listingId=a0N30000003KNErEAO .  

Since I love entity relationship diagrams, I had to check it out. I find a good ERD can help keep you sane when dealing with large data models. And I'm frequently annoyed that I can't find ERD Tools that meet my needs. I feel like I've tried every ERD Plugin in eclipse and been disappointed everytime.

This application is very simple. Once you install it, all you have to do is select which objects you want to have available on the ER Diagram. It gives you a simple multiselect picklist where you pick and choose the objects:




After you click Save, it will take you to the Diagram page. Here you click the Sidebar button in the upper left to select which Objects you want to display in your ERD.

Now all you have to do is click on those objects, and the applicaiton will automatically start plopping the objects on the ERD. By default, it seems to give you the small (non-expanded) entity, but if you click the plus sign in the upper right it expands it with the field level information. Very cool! You can drag and move the entities around straight in your browser via HTML5 Canvas tag.





Bottom line: If your a SF Consultant or Developer who needs to generate ER Diagrams, check this tool out. I'm excited to see what other enhancements they add to this tool. Some cool enhancements would be the ability to save your diagrams to a file, and or email diagrams from straight from the tool to clients.