<xf:group> inside an <xf:group>?

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

<xf:group> inside an <xf:group>?

aceospade
Is it possible to have a group inside of a group and have the first
group reference one instance and the second group reference a separate
instance? How about a <xf:repeat> inside of a group is that also
possible? Finally how can you save a multiple form document? Any
insight on this is greatly appreciated.
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

Aaron Reed
Hi Matthew,

I don't know exactly what you mean by 'save a multiple form document',
so I'll need more details of what you are trying to do with that one.

With your other questions, sure you can.  Here is an example that
contains both.

<xf:group ref="myDefaultInstance/data1">
   <xf:group ref="instance('instance2')/someOtherData">
     <xf:repeat nodeset="instance('inst3')//bar">
     ...
     </xf:repeat>
   </xf:group>
</xf:group>

aceospade wrote:
> Is it possible to have a group inside of a group and have the first
> group reference one instance and the second group reference a separate
> instance? How about a <xf:repeat> inside of a group is that also
> possible? Finally how can you save a multiple form document? Any
> insight on this is greatly appreciated.
> Matthew
>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
What I mean by multiple form document is that you have many switch/
cases and the on the last form you have the submission button. But it
needs to save all of the data entered from the previous forms. Say the
first form you select your name from a select1, then the second form
you enter a date and how many hours it took to complete the task and
the third form you enter what chores you did for that day and press
save and it saves all of that data to an external XML file. Just
something I was curious about. Thanks for the example I will
definitely try to use it and learn how it works.
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

Aaron Reed
So you are using a switch and some cases to build a form that behaves
like a wizard?  I guess what I don't get is why you say 'multiple
forms'.  The switch with a bunch of cases are all contained in the same
.xhtml document, right?  The 'form' is the whole document.  As long as
you are putting all of the data you are gathering from users into an
instance document, all you have to do to 'save' the instance data is to
do a xf:submission.  Then you can put the data where you want.  That
could be on the local file system or submitting to a servlet or some PHP
  to save off the information on the server.

--Aaron

aceospade wrote:

> What I mean by multiple form document is that you have many switch/
> cases and the on the last form you have the submission button. But it
> needs to save all of the data entered from the previous forms. Say the
> first form you select your name from a select1, then the second form
> you enter a date and how many hours it took to complete the task and
> the third form you enter what chores you did for that day and press
> save and it saves all of that data to an external XML file. Just
> something I was curious about. Thanks for the example I will
> definitely try to use it and learn how it works.
> Matthew
>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
Would each model that has an instance have an xf:submission? Yes there
is one switch item which several cases all in one xhtml form. The
submit button is on the last case and needs to save all of the
previous entered data from the previous cases.
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

Aaron Reed
Hi Matthew,

You'll need to have at least one xf:submission for each instance
document that contains data that you want to submit.  In your case,
since I assume you want to save all of your gathered data in one file,
I'd suggest keeping it all in the same instance document.  The other
option would be to copy all the data that you want to save in that one
file from all of the different source instance documents prior to
submission.

--Aaron



aceospade wrote:
> Would each model that has an instance have an xf:submission? Yes there
> is one switch item which several cases all in one xhtml form. The
> submit button is on the last case and needs to save all of the
> previous entered data from the previous cases.
> Matthew
>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
Does that mean multiple models and the xf:submission is inside the
xf:instance? Or just one big instance with the data inside of that?
What is the copy about would that be xf:copy and then tell it what
data that needs to be copied? Thank you for you help Aaron.
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
So it's better to have one model with separate instances and reference
them that way? What I am trying to do now is to have a form display a
list of movies and have the user pick one from a drop down
list(select1), then the data for that movie is shown on the screen.
This part works however, when I try to duplicate the same drop down
list on using a switch/case the information in the drop down does not
display and no movie can be selected. How would you use the same
select1 on different cases?
Thanks in advance,
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

Devdatta Akhawe
Hey,
maybe you could send the code ... I didn't really understand what you
meant there.

Why would you want to duplicate the same functionality?

Regards,
dev
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
In reply to this post by aceospade
Here is what I have so far.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/
2001/xml-events"
        xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xf="http://
www.w3.org/2002/xforms"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xs="http://www.w3.org/2001/XMLSchema">

        <head>
                <title>Star Wars Movies</title>

                <xforms:model id="MovieModel">
                        <xforms:instance id="movies" src="movies.xml" xmlns="" />
                        <xforms:instance id="formData" xmlns="">
                                <data>
                                        <movie>Empire Strikes Back</movie>
                                </data>
                        </xforms:instance>

                        <xforms:bind nodeset="instance('Movie')">
                                <xforms:bind nodeset="/data/Movie/Title" required="true( )"
id="title" />
                                <xforms:bind nodeset="/data/Movie/Release" required="true( )"
id="release" />
                                <xforms:bind nodeset="/data/Movie/Director" required="true( )"
id="director" />
                                <xforms:bind nodeset="/data/Movie/Episode" required="true( )"
id="episode" />
                                <xforms:bind nodeset="/data/Movie/Characters" required="true( )"
id="characters" />
                        </xforms:bind>

                        <xforms:instance id="formData2" xmlns="">
                                <data>
                                        <movie>Revenge of the Sith</movie>
                                </data>
                        </xforms:instance>

                        <xforms:instance id="formData3" xmlns="">
                                <data>
                                        <movie>A New Hope</movie>
                                </data>
                        </xforms:instance>

                        <!-- <xforms:bind nodeset="instance('Movie')">
                                <xforms:bind nodeset="/data/Movie/Title" required="true( )"
id="title" />
                                <xforms:bind nodeset="/data/Movie/Release" required="true( )"
id="release" />
                                <xforms:bind nodeset="/data/Movie/Director" required="true( )"
id="director" />
                                <xforms:bind nodeset="/data/Movie/Episode" required="true( )"
id="episode" />
                                <xforms:bind nodeset="/data/Movie/Characters" required="true( )"
id="characters" />
                        </xforms:bind>
                        <xforms:submission id="submit" ref="instance('Movie')"
action="file:///C:/movie.xml" replace="none" method="put" /> -->

                </xforms:model>
        </head>

        <body>
        <xforms:switch>
                <xforms:case id="1">

                <xforms:select1 ref="instance('formData')/movie">
                        <xforms:label><b>Film: </b></xforms:label>
                        <xforms:itemset nodeset="Movie/Title/@id">
                                <xforms:label ref="." />
                                <xforms:value ref="."/>
                        </xforms:itemset>
                </xforms:select1>

                <xforms:group ref="Movie[Title/@id = instance('formData')/movie]"
id="1">
                        <dl>
                                <dt><b>Title: </b><xforms:output ref="Title/@id"/></dt>
                                <dt><b>Release: </b><xforms:output ref="Release"/></dt>
                                <dt><b>Director: </b><xforms:output ref="Director"/></dt>
                                <dt><b>Episode: </b><xforms:output ref="Episode"/></dt>
                                <dt><b>Characters: </b><xforms:output ref="Characters"/></dt>
                        </dl>
                </xforms:group>

                <xforms:group>
                                <xforms:trigger>
                                        <xforms:label>1</xforms:label>
                                        <xforms:toggle case="1" ev:event="DOMActivate" />
                                </xforms:trigger>
                                <xforms:trigger>
                                        <xforms:label>2</xforms:label>
                                        <xforms:toggle case="2" ev:event="DOMActivate" />
                                </xforms:trigger>
                                <xforms:trigger>
                                        <xforms:label>3</xforms:label>
                                        <xforms:toggle case="3" ev:event="DOMActivate" />
                                </xforms:trigger>
                        </xforms:group>
                                        <xforms:trigger>
                                <xforms:label>
                                        <b>Add an entry?</b>
                                </xforms:label>

                                <xforms:insert ev:event="DOMActivate"
                                        context="instance('formData')" nodeset="movie" at="1"
                                        position="after" origin="instance('formData')" />
                        </xforms:trigger>
                </xforms:case>

                <xforms:case id="2">

                <xforms:select1 ref="instance('formData')/movie">
                        <xforms:label><b>Film: </b></xforms:label>
                        <xforms:itemset nodeset="Movie/Title/@id">
                                <xforms:label ref="." />
                                <xforms:value ref="."/>
                        </xforms:itemset>
                </xforms:select1>

<xforms:group ref="Movie[Title/@id = instance('formData2')/movie]">
                        <dl>
                                <dt><b>Title: </b><xforms:output ref="Title/@id"/></dt>
                                <dt><b>Release: </b><xforms:output ref="Release"/></dt>
                                <dt><b>Director: </b><xforms:output ref="Director"/></dt>
                                <dt><b>Episode: </b><xforms:output ref="Episode"/></dt>
                                <dt><b>Characters: </b><xforms:output ref="Characters"/></dt>
                        </dl>
                </xforms:group>
                <xforms:group>
                                <xforms:trigger>
                                        <xforms:label>1</xforms:label>
                                        <xforms:toggle case="1" ev:event="DOMActivate" />
                                </xforms:trigger>
                                <xforms:trigger>
                                        <xforms:label>2</xforms:label>
                                        <xforms:toggle case="2" ev:event="DOMActivate" />
                                </xforms:trigger>
                                <xforms:trigger>
                                        <xforms:label>3</xforms:label>
                                        <xforms:toggle case="3" ev:event="DOMActivate" />
                                </xforms:trigger>
                        </xforms:group>
                </xforms:case>
                <xforms:case id="3">

                <xforms:select1 ref="instance('formData')/movie">
                        <xforms:label><b>Film: </b></xforms:label>
                        <xforms:itemset nodeset="Movie/Title/@id">
                                <xforms:label ref="." />
                                <xforms:value ref="."/>
                        </xforms:itemset>
                </xforms:select1>

<xforms:group ref="Movie[Title/@id = instance('formData3')/movie]">
                        <dl>
                                <dt><b>Title: </b><xforms:output ref="Title/@id"/></dt>
                                <dt><b>Release: </b><xforms:output ref="Release"/></dt>
                                <dt><b>Director: </b><xforms:output ref="Director"/></dt>
                                <dt><b>Episode: </b><xforms:output ref="Episode"/></dt>
                                <dt><b>Characters: </b><xforms:output ref="Characters"/></dt>
                        </dl>
                </xforms:group>
                <xforms:group>
                                <xforms:trigger>
                                        <xforms:label>1</xforms:label>
                                        <xforms:toggle case="1" ev:event="DOMActivate" />
                                </xforms:trigger>
                                <xforms:trigger>
                                        <xforms:label>2</xforms:label>
                                        <xforms:toggle case="2" ev:event="DOMActivate" />
                                </xforms:trigger>
                                <xforms:trigger>
                                        <xforms:label>3</xforms:label>
                                        <xforms:toggle case="3" ev:event="DOMActivate" />
                                </xforms:trigger>
                        </xforms:group>
                        <xf:label>Favorite:
                        <xf:input />
</xf:label>
                </xforms:case>
                </xforms:switch>
                <xforms:submit submission="submit">
                        <xforms:label> Save </xforms:label>
                </xforms:submit>

        </body>
</html>

The XML will follow.

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
and the data file.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE Movies_Root>

<Movies_Root id="Star Wars Movies">
        <Title>Star Wars Movies</Title>
        <!--  A listing of Star Wars movies by release date -->

        <Movie>
                <Title id="A New Hope" />
                <Release>1977</Release>
                <Director>George Lucas</Director>
                <Episode>IV</Episode>
                <Characters>Luke, Leia, Han, Chewbacca</Characters>
        </Movie>

        <Movie>
                <Title id="Empire Strikes Back" />
                <Release>1980</Release>
                <Director>George Lucas</Director>
                <Episode>V</Episode>
                <Characters>Luke, Leia, Darth Vader, Lando</Characters>
        </Movie>

        <Movie>
                <Title id="Return of the Jedi" />
                <Release>1983</Release>
                <Director>George Lucas</Director>
                <Episode>VI</Episode>
                <Characters>Luke, Boba Fett, Jabba the hutt</Characters>
        </Movie>

        <Movie>
                <Title id="The Phantom Menace" />
                <Release>1999</Release>
                <Director>George Lucas</Director>
                <Episode>I</Episode>
                <Characters>Anakin, Qui-Gonn, Obi-Won</Characters>
        </Movie>

        <Movie>
                <Title id="Attack of the Clones" />
                <Release>2002</Release>
                <Director>George Lucas</Director>
                <Episode>II</Episode>
                <Characters>Anakin, Obi-Won, Count Dooku</Characters>
        </Movie>

        <Movie>
                <Title id="Revenge of the Sith" />
                <Release>2005</Release>
                <Director>George Lucas</Director>
                <Episode>III</Episode>
                <Characters>Anakin, Obi-Won, Mace Windu, Emperor Palpatine</
Characters>
        </Movie>

</Movies_Root>

Thanks so much for taking the time.
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
Okay I have the form submitting the Title of the movie but now I am
wondering how to get the rest of the data from the XML document to be
submitted along with it? I have the submit referencing the formData
instance but all it puts out is the title? Any thoughts or ideas?
updated: <xforms:submission id="submit" ref="instance('formData')"
action="file:///C:/movie.xml" replace="none" method="put" />
Thank you.
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

aceospade
What needs to happen now is that when a movie is selected and the save
button is pressed then the corresponding data will be included in the
XML document saved data.
Corresponding data=Release, Director, Episode and Characters. So in
other words it will go from XML document to XML document. The data is
displayed on the screen but now I am wondering how to get the
corresponding data to save as well?
Any thoughts or ideas?Anyone?
Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: <xf:group> inside an <xf:group>?

Aaron Reed
Hi Matthew,

I'm sorry, this thread fell completely off of my radar and I now see
that we never got your questions answered.

Could you please open a new thread (to get it back on the radar)
letting us know where you are now with your progress, if you are stuck
on the same question or if you have a new one, etc. and we'll try to
get you rolling again.

Sorry for the lack of reply,
--Aaron


On Jul 5, 1:38 pm, aceospade <[hidden email]> wrote:
> What needs to happen now is that when a movie is selected and the save
> button is pressed then the corresponding data will be included in the
> XML document saved data.
> Corresponding data=Release, Director, Episode and Characters. So in
> other words it will go from XML document to XML document. The data is
> displayed on the screen but now I am wondering how to get the
> corresponding data to save as well?
> Any thoughts or ideas?Anyone?
> Matthew

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms