• JackMckracken83
  • NEWBIE
  • 0 Points
  • Member since 2012

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

I'm currently using jsTree in a Visualforce page as an interface to add/edit records. The user can right click on an element in the tree, select New from the context menu, and a form for adding a new record is loaded into a JQuery dialog box. Once they submit the form, I need to pass the ID of the new record to a function that will add a new node to the jsTree with an id = the new record ID. So far I'm having zero luck. I'm overriding the standard controller's "save" action in order to set an id variable so that it can be accessed via JQuery, but its never getting set.

 

Controller Extension:

public with sharing class extTrack {
    private Apexpages.StandardController controller;
    private final Track__c track;
    
    public String trackId { get; set; }
    
    public extTrack(ApexPages.StandardController stdController){
        this.controller = stdController;
        this.track = (Track__c)stdController.getRecord();
    }
    
    public PageReference saveTrack() {
        String trackId = ApexPages.currentPage().getParameters().get('id');
        
        if(trackId == null) {
            insert track;
            trackId = track.id;
        } else {
            this.controller.save();
        }
        
        return null;
    }
}

 

VisualForce page:

<apex:page standardController="Track__c" extensions="extTrack" showHeader="false" sidebar="false">
    <apex:includescript value="{!URLFOR($Resource.CKEditor, 'ckeditor/ckeditor.js')}" />
    <script>
        function closeTrack() {
            alert("{!trackId}"); //this is always blank
            if($.trim('{!trackName}') != '') var newNode = addNode($('tracks'),'{!trackName}','{!trackId}',false);
            $("#objProps").dialog("close");
        }
    </script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />
            <div>
                <div class="propsLbl">Name:</div>
                <apex:inputField value="{!Track__c.Name}" />
            </div>
            <div>
                <div class="propsLbl">Description:</div>
                <apex:inputtextarea id="trackDesc" value="{!Track__c.Description__c}" styleClass="ckeditor" richtext="false"/>
                <script>
                    CKEDITOR.replace( '{!$Component.trackDesc}',
                        {
                            filebrowserBrowseUrl : '{!$Page.SiteFileBrowser}',
                            filebrowserImageBrowseUrl : '{!$Page.SiteFileBrowser}'
                        });
                        
                    function beforeTextSave() {
                        var objEditor = CKEDITOR.instances['{!$Component.trackDesc}'];
                        document.getElementById('{!$component.trackDesc}').value = objEditor.getData();
                    }
                </script>
            </div>
            <div>
                <div class="propsLbl coll">Active:</div>
                <apex:inputField value="{!Track__c.Active__c}" />
            </div>
            <div class="propsBtns">
                <apex:commandButton value="Cancel" onClick="CKEDITOR.instances['{!$Component.trackDesc}'].destroy();$("#objProps").dialog("close");" reRender="none" />
                <apex:commandButton value="Save Track" onClick="beforeTextSave();" action="{!saveTrack}" reRender="none" status="saveStatus" />
                <apex:actionStatus startText="(Saving...)" onStop="closeTrack()" id="saveStatus"/>
            </div>
        </apex:pageBlock>
    </apex:form>
</apex:page>

We have a need for a Salesforce developer to assist with integrating Linvio PaymentConnect with a series of custom Visualforce pages. We estimate this will require 8-16 hours of development. Please contact me for more details.

I'm trying to use the code below to insert a new ViewTime (custom object) record into Salesforce. Currently I'm getting a "Cannot access a property or method of a null object reference" when I try to set ANY of the properties. I've even commented them out and tried to set just one at a time but none of them will accept a value. Apparently I'm instantiating the SObject incorrectly, but the code below is what I've found in all of the examples that I could find online. Am I missing an import?

 

                   var vidView:SObject = new SObject('ViewTime__c');
                   
                   vidView.Name = _config.clipId + new Date().toString();
                   vidView.observationVideo__c = _config.clipId;
                   vidView.User__c = _config.userId;
                   
                   _conn.create( [vidView],
                             new AsyncResponder(
                                function handleSaveResult():void {
                                    log.debug("view saved");
                                }
                            )
                        );

I've got a quiz-type application built. I set up a question object and a question response object, the response obv being a child of the question. I've managed to build a page that renders out the questions and a textbox for each so the user can type in an answer. The portion that's giving me a really hard time is trying to save the user's responses. Seems like this should be REALLY simple, but I've been going round and round. Basically I'm trying to instantiate a new response object for each question when the page loads, then have a value from a textbox for each question assigned to a field in the response object and saved. My problem is what variable to assign to the textboxes? Shouldn't I be able to add a new response object to each question's response collection when the page loads, assign the text of each response to the variable of the textbox, and then loop through and save each response? This seems like really common functionality - does anyone know of an example that they can point me to?

I've got a tree view of nested categories on the left side of my page - I'd like for the user to be able to click one of the categories and see a list of related videos on the right side of the page. Is there an available snippet or tutorial out there with this type of functionality?

I'm currently using jsTree in a Visualforce page as an interface to add/edit records. The user can right click on an element in the tree, select New from the context menu, and a form for adding a new record is loaded into a JQuery dialog box. Once they submit the form, I need to pass the ID of the new record to a function that will add a new node to the jsTree with an id = the new record ID. So far I'm having zero luck. I'm overriding the standard controller's "save" action in order to set an id variable so that it can be accessed via JQuery, but its never getting set.

 

Controller Extension:

public with sharing class extTrack {
    private Apexpages.StandardController controller;
    private final Track__c track;
    
    public String trackId { get; set; }
    
    public extTrack(ApexPages.StandardController stdController){
        this.controller = stdController;
        this.track = (Track__c)stdController.getRecord();
    }
    
    public PageReference saveTrack() {
        String trackId = ApexPages.currentPage().getParameters().get('id');
        
        if(trackId == null) {
            insert track;
            trackId = track.id;
        } else {
            this.controller.save();
        }
        
        return null;
    }
}

 

VisualForce page:

<apex:page standardController="Track__c" extensions="extTrack" showHeader="false" sidebar="false">
    <apex:includescript value="{!URLFOR($Resource.CKEditor, 'ckeditor/ckeditor.js')}" />
    <script>
        function closeTrack() {
            alert("{!trackId}"); //this is always blank
            if($.trim('{!trackName}') != '') var newNode = addNode($('tracks'),'{!trackName}','{!trackId}',false);
            $("#objProps").dialog("close");
        }
    </script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />
            <div>
                <div class="propsLbl">Name:</div>
                <apex:inputField value="{!Track__c.Name}" />
            </div>
            <div>
                <div class="propsLbl">Description:</div>
                <apex:inputtextarea id="trackDesc" value="{!Track__c.Description__c}" styleClass="ckeditor" richtext="false"/>
                <script>
                    CKEDITOR.replace( '{!$Component.trackDesc}',
                        {
                            filebrowserBrowseUrl : '{!$Page.SiteFileBrowser}',
                            filebrowserImageBrowseUrl : '{!$Page.SiteFileBrowser}'
                        });
                        
                    function beforeTextSave() {
                        var objEditor = CKEDITOR.instances['{!$Component.trackDesc}'];
                        document.getElementById('{!$component.trackDesc}').value = objEditor.getData();
                    }
                </script>
            </div>
            <div>
                <div class="propsLbl coll">Active:</div>
                <apex:inputField value="{!Track__c.Active__c}" />
            </div>
            <div class="propsBtns">
                <apex:commandButton value="Cancel" onClick="CKEDITOR.instances['{!$Component.trackDesc}'].destroy();$("#objProps").dialog("close");" reRender="none" />
                <apex:commandButton value="Save Track" onClick="beforeTextSave();" action="{!saveTrack}" reRender="none" status="saveStatus" />
                <apex:actionStatus startText="(Saving...)" onStop="closeTrack()" id="saveStatus"/>
            </div>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I've got a quiz-type application built. I set up a question object and a question response object, the response obv being a child of the question. I've managed to build a page that renders out the questions and a textbox for each so the user can type in an answer. The portion that's giving me a really hard time is trying to save the user's responses. Seems like this should be REALLY simple, but I've been going round and round. Basically I'm trying to instantiate a new response object for each question when the page loads, then have a value from a textbox for each question assigned to a field in the response object and saved. My problem is what variable to assign to the textboxes? Shouldn't I be able to add a new response object to each question's response collection when the page loads, assign the text of each response to the variable of the textbox, and then loop through and save each response? This seems like really common functionality - does anyone know of an example that they can point me to?

I've got a tree view of nested categories on the left side of my page - I'd like for the user to be able to click one of the categories and see a list of related videos on the right side of the page. Is there an available snippet or tutorial out there with this type of functionality?