Forum Replies Created

  • integrate the image in the rich text.
    with the help of and
    i am sending the screen shot of my visual force page

    ************************************************************************************************************

  • I am using the tag <apex:inputtextarea>’ in my visual force page were 'richtext'=true now i am using this editor for image were when user attach any attachment using the upload file that this image should sucessfully upload in the editor provide by <apex:inputtextarea>

    To upload the image i am using the <apex:image> with properties url='https://www.forcetalks.com/salesforce-topic'

    As user upload the image with this url i want to integerate with the <apex:inputtextarea>  so that user can able to see image in the editor.

    Please find the attachment for further clarification.Capture

  • My use case- In my visual force page I have two tag <apex:inputtextarea > where richtext=true and other is the <apex:image url="https://www.forcetalks.com/salesforce-topic/"> tag were I have image file I need to integrate into one that is in <apex:inputtextarea>
    Please suggest me any idea of solving this issue.

  • Aman

    Any solution to this issue or any work around you have find out.

    Please share with me, as it is priority issue for ticket.

    • This reply was modified 6 years, 8 months ago by  Harsh.
  • Thanks Aman

    Any solution to this issue or any work around.

    • This reply was modified 6 years, 8 months ago by  Harsh.
  • public class ContentController {
    public SObject record {get; private set;}
    public ContentController() {

    }

    public Event myStandardObject;
    public ContentController(ApexPages.StandardController controller) {
    myStandardObject = (Event)controller.getRecord();
    record = (Event)controller.getRecord();
    }

    public blob file { get; set; }

    public PageReference upload() {
    // String encodedContentsString = System.currentPageReference().getParameters().get('fileContents');
    ContentVersion v = new ContentVersion();
    v.versionData = file;
    v.title = 'testing upload';
    v.pathOnClient ='/somepath.txt';
    insert v;
    Event thisMatter = [select id from event where Id = :ApexPages.currentPage().getParameters().get('id')];
    ContentVersion contentVersion_2 = [SELECT Id, Title, ContentDocumentId FROM ContentVersion WHERE Id = :v.Id LIMIT 1];
    List<ContentDocument> documents = [SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument];

    ContentDocumentLink contentlink = new ContentDocumentLink();
    contentlink.LinkedEntityId = thisMatter.id;
    contentlink.contentdocumentid = contentVersion_2.contentdocumentid;
    contentlink.ShareType = 'V';
    insert contentlink;

    // myStandardObject.id=v.id;
    // insert myStandardObject;
    return new PageReference('/' + thisMatter.id);
    }
    }

  • I have made as per your suggestion but still it is not working

    <apex:page standardcontroller=”Event” extensions=”ContentController” sidebar=”False” showHeader=”False”>

    <apex:form >

    <apex:pageBlock >
    <apex:inputTextarea rows="10" cols="177" richText="True" value="{!Event.Description}" onChange="numCheck();" id="UploadImage" />
    <script type="text/JavaScript">
    function numCheck()
    {
    alert(document.getElementById("UploadImage").style.display = "block");
    }
    </script>

    <apex:commandButton value="Save" action="{!save}" />

    </apex:pageBlock>
    <apex:inputFile value="{!file}" />
    <apex:commandbutton action="{!upload}" value="Upload" />
    </apex:form>
    </apex:page>

     

  • <apex:page standardcontroller="Event" extensions="ContentController" sidebar="False" showHeader="False">

    <apex:form >

    <apex:pageBlock >
    <apex:inputTextarea rows="10" cols="177" richText="True" value="{!Event.Description}" style="display:block"/>

    <apex:commandButton value="Save" action="{!save}" />

    </apex:pageBlock>
    <apex:inputFile value="{!file}" />
    <apex:commandbutton action="{!upload}" value="Upload" />
    </apex:form>
    </apex:page>

     

    Can u suggest me in my above code were i should write the display: none;

    as i am new in java script.

  • Hi Pranav,

    Thanks for the code, but can u please implement the same in event object as i am getting it some error when i tried to implement this code in my org.

     

     

     

  • Please help me with the code as i am new in the coding and please do it earliest as it is P1 priority ticket.

    Please make it sure my required is like below snapshot, were i wanted to upload my image in the richtextarea only.

    1222

  • Harsh

    Member
    April 17, 2018 at 12:12 pm in reply to: How to Salesforce Trigger on Event Object?

    On Event object their is no rich text area, so user wanted to have the rich text area, i have created the visual force page and add in the page layout of event.
    I have also add the trigger on event object so when user make any changes in that visual force page than it will save in the attachment as a file text or a image jpg .
    The issue is whenever user make any changes in the rich text area. than every time it is creating the new file and attached in the section, but this need to be stop and only one time it should added and next time they need to update than attachment.
    Hint-
    1. Either my removing the file
    2. Deleting the file