buttons in editor form

buttons in editor form

rwgreenwoodrwgreenwood Posts: 43Questions: 13Answers: 0

Hi,
I have a button in a custom template editor form. It works as I want it to except for one problem - the button displays until the editor has been instantiated. I tried display:none but if I use that it never displays. Any ideas on how to get that to work?

Replies

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Only the button shows up, but not the form? Any chance of a link to a page showing the issue?

    Thanks,
    Allan

  • rwgreenwoodrwgreenwood Posts: 43Questions: 13Answers: 0

    Allan, correct, the button shows but not the form. Once the editor form is opened, however, it all displays correctly. I don't instantiate the editor until the user goes to the editing page (this is a mobile single-page setup, so it's really a div). Before that point in time the button is showing on the page even though the rest of the editor form isn't visible. Once the user goes to the editing page and the editor is instantiated, the button is correctly hidden. Here is the custom form template if that is helpful:

      <div id="customForm" >
          <editor-field name="case_history.history_date"></editor-field>
          <editor-field name="case_history.case_id"></editor-field>
          <editor-field name="case_history.history_action"></editor-field>
          <editor-field name="case_history.contact_type"></editor-field>
          <editor-field name="case_history.contact_name"></editor-field>
          <editor-field name="case_history.staff_id"></editor-field>
          <editor-field name="case_history.notes"></editor-field>
          
       
          <button id='sendemail' onclick='sendEmail();'>Send Email </button>
    
        </div> 
    

    Don't have an easy way to send a link.

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    I see - so you can actually see the button when the page is loaded?

    Try adding style="display:none" to your customForm element. Editor should override that when it makes the form visible.

    Allan

  • rwgreenwoodrwgreenwood Posts: 43Questions: 13Answers: 0

    Allan,
    Yes, I can see the button on the page load. I tried the style on the custom form and the button didn't display on the page, but now the form doesn't display either. The lightbox shows with the title and save button but nothing else.

  • rwgreenwoodrwgreenwood Posts: 43Questions: 13Answers: 0

    p.s. When I inspect the form, the style="display:none;" is still active.

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Sorry - I've given you bad advice here. The display:none thing is the wrong thing to do - I had it in my mind that is what Editor did, but actually that it does is $(init.template).detach(). That should mean that the container element that you give to template will be removed from the document, including any child elements when the Editor is initialised.

    What version of Editor are you using? Also, is the Editor instance initialised when the page is first loaded, and is the template element in the document at that time?

    Regards,
    Allan

  • rwgreenwoodrwgreenwood Posts: 43Questions: 13Answers: 0

    Allan,
    Using editor 1.6 and no, the editor instance is not initialized when the page is first loaded,but it is in the document at that point in time.

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Which sub-version of 1.6? 1.6.3 is the current release.

    Thanks,
    Allan

  • rwgreenwoodrwgreenwood Posts: 43Questions: 13Answers: 0

    Version 1.6.3

This discussion has been closed.