Delete button

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Delete button

gabri124
Hello I'm new testing Orbeon. I have seen that the summary page has the delete button. But i wanna put this button inside the form.
Cause Summary page wont be visible for final user, but I need to give the same functionality to the user inside all the forms.

Can you guide me how to put this delete button inside the forms as summary page?

Cause in summary page we check the forms and we can delete the checked forms. But i wanna delete the form with a button inside the same form.
I think that summary page has the ID form to delete it, but inside the form? Can i get the ID form?

Thank-s for your time.


Reply | Threaded
Open this post in threaded view
|

Re: Delete button

gabri124
Anyone can help me?

I have download the source code of orbeon, but i dont find what proces call delete button.

Reply | Threaded
Open this post in threaded view
|

Re: Delete button

aero
Hey, sorry but I don't have time to look into this but just to point you in the right direction:

Go under: /orbeon/WEB-INF/lib
Unzip orbeon-form-runner.jar
In the resulting folder find: apps/fr/components/buttons.xsl
Those are the buttons that can be used on the form view.
Create a definition for the delete button that you want. For inspiration you can also look under apps/fr/summary/view.xhtml for some info on the summary page delete button process/dialog confirmation.
After you create your delete button definition, zip back the folder tree apps/..  into orbeon-form-runner.jar

Next go to /orbeon/WEB-INF/resources/config/properties-local.xml   (may depend on orbeon version? see here for info: http://wiki.orbeon.com/forms/doc/developer-guide/configuration-properties/configuration-properties-form-runner )
and add/modify this property to specify the buttons (include delete) you want to appear on the forms:
<property as="xs:string"  name="oxf.fr.detail.buttons.*.*" value="save pdf submit close"/>

Good luck
Reply | Threaded
Open this post in threaded view
|

Re: Delete button

gabri124
Thank's Aero, but I wanna find the process that is called from delete button, I cant find it, maybe it is inside a jar file?
Reply | Threaded
Open this post in threaded view
|

Re: Delete button

gabri124
This post was updated on .
I have declare this button on buttons.xsl

  <xsl:template match="fr:delete-button">
        <fr:button id="fr-delete-button" xxforms:modal="true">
            <xforms:label>
                <xhtml:img width="16" height="16" src="/apps/fr/style/images/pixelmixer/delete_16.png" alt=""/>
               
                <xhtml:span><xforms:output ref="$fr-resources/summary/labels/delete-form"/></xhtml:span>
            </xforms:label>
              <xforms:action ev:event="DOMActivate">
                <xxforms:variable name="document-name"select="xxforms:get-request-attribute('document')" as="xs:string"/>
                              <xforms:dispatch name="fr-delete-data" targetid="fr-persistence-model">
                                    <xxforms:context name="document-id" select="$document-name"/>
                                </xforms:dispatch>
            </xforms:action>
           
        </fr:button>
    </xsl:template>


The problem is how can i get the document name from form and put this information here

 <xxforms:variable name="document-name" select="??"as="xs:string"/>

I think if I can put this information on select, I  can dispatch the same action as summary delete works.
Reply | Threaded
Open this post in threaded view
|

Re: Delete button

gabri124
Anyone can help me, how can i get a field value from my form and put in this code

   <xxforms:variable name="document-name" select="FIELD VALUE" as="xs:string"/>

The delete is working if i can put the id (in hardcode mode i put the value of Id and it is working).

Regards Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: Delete button

aero
Hello, try using xxforms:document-id() as xs:string
Reply | Threaded
Open this post in threaded view
|

Re: Delete button

gabri124
aero wrote
Hello, try using xxforms:document-id() as xs:string
tY aERO, i have tried but it didn't work

 <xsl:template match="fr:delete-button">
        <fr:button id="fr-delete-button" xxforms:modal="true">
            <xforms:label>
                <xhtml:img width="16" height="16" src="/apps/fr/style/images/pixelmixer/delete_16.png" alt=""/>
               
                <xhtml:span><xforms:output ref="$fr-resources/summary/labels/delete-form"/></xhtml:span>
            </xforms:label>
              <xforms:action ev:event="DOMActivate">
                <xxforms:variable name="document-name" select="'xxforms:document-id()'" as="xs:string"/>
                              <xforms:dispatch name="fr-delete-data" targetid="fr-persistence-model">
                                    <xxforms:context name="document-id" select="$document-name"/>
                                </xforms:dispatch>
            </xforms:action>
           
        </fr:button>
    </xsl:template>
Reply | Threaded
Open this post in threaded view
|

Re: Delete button

aero
Okay, use xxforms:instance('fr-parameters-instance')/document like so:

<xxforms:variable name="document-name" select="xxforms:instance('fr-parameters-instance')/document" as="xs:string"/>
<xforms:dispatch name="fr-delete-data" targetid="fr-persistence-model">
     <xxforms:context name="document-id" select="$document-name"/>
</xforms:dispatch>

Also you should add the delete confirmation dialog, and you should clear the form after delete and redirect the user. Or something of that nature.

Cheers