Activity Forums Salesforce® Discussions How to hide "display:none" in html tag on a Visualforce Page Component?

  • Aman

    Member
    April 19, 2018 at 7:31 am

    Hi Harsh ,

    You can replace the display :none by display : block. It will let you show your upload image Tab. One more thing if you want to render this tab after some action performed ,you can write a script but for that add an id to your html tag and add the below code to your script

    document.getElementById("UploadImage").style.display = "block";

  • Harsh

    Member
    April 19, 2018 at 8:09 am

    <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.

  • Harsh

    Member
    April 19, 2018 at 8:25 am

    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>

     

  • Aman

    Member
    April 19, 2018 at 9:17 am

    can you please send the controller extension code ? so that i can try it at my end.

  • Harsh

    Member
    April 19, 2018 at 9:26 am

    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);
    }
    }

  • Aman

    Member
    April 19, 2018 at 11:11 am

    Hi,

    Here the JavaScript is not executing. The reason is that when we add <apex:inputTextarea richText="true" ... it add hidden text area and its own iframe that shows as a text editor So when you add events to your text area its not get added to the text area which is displayed to user.

     

  • Harsh

    Member
    April 19, 2018 at 11:59 am

    Thanks Aman

    Any solution to this issue or any work around.

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

    Member
    April 19, 2018 at 12:48 pm

    Hi,

    I will look into it and will let you know.

  • Harsh

    Member
    April 20, 2018 at 8:11 am

    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, 7 months ago by  Harsh.
  • Harsh

    Member
    April 30, 2018 at 4:39 am

    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

    Member
    April 30, 2018 at 9:38 am

    Hi Harsh,

    I didn't get your point 'I need to integrate into one that is in <apex:inputtextarea>'. Please elaborate your problem a little more.

    Thanks

  • Harsh

    Member
    April 30, 2018 at 1:06 pm

    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

  • Harsh

    Member
    May 2, 2018 at 1:21 pm

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

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

Log In to reply.

Popular Salesforce Blogs