1 Replies - 334 Views - Last Post: 13 February 2017 - 10:27 AM

#1 CATCODE   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 19-October 16

Problem with prime faces <p:editor/> on <div> toggle w

Posted 11 February 2017 - 03:55 PM

My requirement is to hide the content of a <div> tag on jsf page and only show the contents when a button is clicked.
tried this js code:
function toggle_toggle(id){
              var e = document.getElementById(id);
              if(e.style.display === 'none')
                  e.style.display = 'block';
                  e.style.display = 'none';

works fine except that <p:editor> dont get shown when button is clicked to show div content.

here's the div i want to show/hide on click of
<p:commandLink  id="them" style=" color: #a6a6a6;" value="Comment" onclick="toggle_toggle('show_hide')"   type="button" />

   <div id="show_hide" style="display:none;">
           <p:growl id="messages" sticky="true"/>                   
        <h:inputText value="#{editorView.commentor}" title="Your Name here" required="true" style="margin-bottom:2px;"/>
        <p:editor id="editor"  widgetVar="editorWidget"  value="#{editorView.text}" width="600" required="true" controls="bold italic underline strikethrough superscript bullets numbering justify highlight image link undo redo" />
    <h:panelGrid columns="2" style="margin-top: 4px; margin-left: 400px;">
        <p:commandButton value="Submit" action="#{editorView.action()}">
                  <f:setPropertyActionListener target="#{editorView.thread}" value="#{testBean.msqlN}" />
        <p:commandButton value="Clear" type="button" onclick="PF('editorWidget').clear();" style="width:100px;" />

would anyone mind pointing out how to refactor this to make p:editorshow on div toggle?

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with prime faces <p:editor/> on <div> toggle w

#2 ArtificialSoldier   User is online

  • D.I.C Lover
  • member icon

Reputation: 2041
  • View blog
  • Posts: 6,263
  • Joined: 15-January 14

Re: Problem with prime faces <p:editor/> on <div> toggle w

Posted 13 February 2017 - 10:27 AM

If you start the div off visible, does it display the other element correctly? If so, then maybe start it off visible but then use Javascript to hide it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1