cjames728
cjames728

Reputation: 193

Edit mode button

I've been thrashing around this issue for the past 2 days. I have an xPage view. I click on a link/doc, it takes me to the document in read mode. I want to have an "Edit" button at the top of that document to take me into read mode. I've looked around and found a command to do so.

I create a button. In the onClick event of the button, I make a line of server-sided code;

context.setDocumentMode("edit");

I save the form, go back to the view, click on the doclink, and now the document immediately comes up in edit mode. Its as if opening the doc executes the onClick event of this button. I want it to wait until I ACTUALLY press the button.

If I remove the button, then the doc comes up in read-mode.

To make sure something wasn't whacked, I made a REAL simple database with one form called test. One field in the form, a view called testview, then created 2 documents with the form. Created an xPage called xTestview using testview and an xPage form called xTestForm with the button and the field. Can't get much simpler than that. Happens exactly the same there too.

Upvotes: 0

Views: 784

Answers (1)

Per Henrik Lausten
Per Henrik Lausten

Reputation: 21709

Here's a simple edit button that you can use instead:

<xp:button value="Edit" id="edit" rendered="#{javascript:!document.isEditable()}">
    <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
        <xp:this.action>
            <xp:changeDocumentMode mode="edit"></xp:changeDocumentMode>
        </xp:this.action>
    </xp:eventHandler>
</xp:button>

Upvotes: 4

Related Questions