Logging Hours of time spent watching movies.

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

Re: Logging Hours of time spent watching movies.

aceospade
Do I have to have an empty template? I guess that was one way I
thought would keep an entry from being completely deleted off of the
screen. The same goes for the add movies. Is there any easier way so I
won't have to have an empty template?  Also on the message that
appears could that be a modeless or modal by any chance? Thank you
have been a tremendous help in solving this.
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: Logging Hours of time spent watching movies.

aceospade
The repeat button on Add an Entry. When the form loads up there is one
entry right? So what I did was entered movies into that entry with
hours that were valid. Then I hit the Add an Entry button and started
to add movies and hours to the second entry. But when I wanted to go
back to the first entry and add another movie the Add Movie button
didn't allow me to do anything. Did you get the same response? Add
Movies/Hours to the first entry and then Add an Entry.  Add Movies/
Hours to the second entry but now try and go back to the first entry
and Add Movie. Is this something that can be allowed to happen or does
the form only concentrate on the current entry? Thanks again,
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: Logging Hours of time spent watching movies.

Clark, John
> The repeat button on Add an Entry. When the form loads up
> there is one entry right? So what I did was entered movies
> into that entry with hours that were valid. Then I hit the
> Add an Entry button and started to add movies and hours to
> the second entry. But when I wanted to go back to the first
> entry and add another movie the Add Movie button didn't allow
> me to do anything. Did you get the same response?

Yes, I do see that behaviour.  You may have discovered a Mozilla XForms
Extension bug.  I'll try to distill your test case into a smaller form
that demonstrates the bug; I suspect it has to do with the ID reference
resolution algorithm[0].

[0] http://www.w3.org/TR/2007/WD-xforms11-20070222/#idref-resolve

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.



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

RE: Logging Hours of time spent watching movies.

Clark, John
In reply to this post by aceospade
> Do I have to have an empty template? I guess that was one way
> I thought would keep an entry from being completely deleted
> off of the screen. The same goes for the add movies. Is there
> any easier way so I won't have to have an empty template?

I'm sorry, but I don't understand what you mean, here.  I don't know how
templates would influence node deleting.

> Also on the message that appears could that be a modeless or
> modal by any chance?

The message that indicates that the times don't match?  You could
emulate a modal message using CSS; the "Delete Confirm with CSS" chapter
of the "XForms" Wikibook[0] has a great example of this kind of
approach.  Also, you could skip the CSS approach entirely and do the
checking at submission time; if something is invalid, then you can
display a modal message easily using the `xf:message` action.  This will
be a LOT easier when the Mozilla XForms Extension supports the `if`
attribute on actions.

[0] http://en.wikibooks.org/wiki/XForms/Delete_Confirm_with_CSS

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.



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

Re: Logging Hours of time spent watching movies.

aceospade
In reply to this post by aceospade
If you take away the nodeset="Allocated[position()!=last()]" in
<xf:delete nodeset="Allocated[position()!=last()]"
at="index('newmovies-list')" /> and change it to nodeset="Allocated"
the entire movie/hours entry is able to be deleted off of the screen.
So I put a template that would be in the last position. You mentioned
something about having all of that stored in a separate instance. What
did you mean by that?

After some hacking, I ran into the
message:

Warning: XForms Warning (5): Submission validation failed for node
Source Code:
<EntryDate/>

which caused me to notice that you assert that `EntryDate` must have
type `xsd:date`, but you always leave a single "template" `TimeData`
element as the last child of the `Time` element, which will always
have
an empty `EntryDate` child.  As I mentioned earlier, one way to deal
with this would be to move your templates into a separate instance.

Then after the submission I noticed that there were empty templates in
the XML data. That is when I noticed the double data in the instance.
I guess this is something nit picky but I didn't know if it could be
"Cleaned up" any? Thank you for everything. You have been a great
help.
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: Logging Hours of time spent watching movies.

aceospade
Also I noticed that when the Add Movie button was hit there was always
an "empty" Movie/Hours. is this because of the templates also?
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: Logging Hours of time spent watching movies.

Clark, John
In reply to this post by aceospade
Matthew,

> If you take away the nodeset="Allocated[position()!=last()]"
> in <xf:delete nodeset="Allocated[position()!=last()]"
> at="index('newmovies-list')" /> and change it to nodeset="Allocated"
> the entire movie/hours entry is able to be deleted off of the screen.
> So I put a template that would be in the last position. You
> mentioned something about having all of that stored in a
> separate instance. What did you mean by that?

Well, the way I usually approach this sort of problem is to start off
with an empty list of items, so you'd have an instance like:

  <xf:instance>
    <Time xmlns="">
      <TimeData>
        <Movie />
        <EntryDate />
        <StartTime />
        <StopTime />
        <BreakTime />
        <TotalEntryTime />
        <TotalHours />
      </TimeData>
    </Time>
  </xf:instance>

Note the lack of any `Allocated` elements.

Then, when you press the "Add Movie" button, you would copy a "empty
movie allocation" template into the `TimeData` element above.  This
template might be declared in an instance as follows:

  <xf:instance id="allocationTemplate">
    <Allocated xmlns="">
      <Movie/>
      <Hours/>
    </Allocated>
  </xf:instance>

(Or you could have one instance that contains templates for any elements
that need one.  I have used both approaches.  Also, this same type of
design would apply to your default instance, as well, which starts off
with two empty "templates".)

Then you could set the movie value to what is selected (using an
`xf:setvalue` action), and enter the hours for the movie in the field
that would appear.  Each `Allocated` element contained within a
`TimeData` element would correspond to one user entry.

> Then after the submission I noticed that there were empty
> templates in the XML data. That is when I noticed the double
> data in the instance.
> I guess this is something nit picky but I didn't know if it
> could be "Cleaned up" any?

Sure, you could clean this up by not including templates in your
"content" instances; alternatively, based on your current design, you
could mark your "template" elements as being non-relevant (using the
`relevant` model item property).  By default, elements marked as
non-relevant are not serialized upon submission.

> Also I noticed that when the Add Movie button was hit
> there was always an "empty" Movie/Hours. is this because
> of the templates also?

That's right.

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.



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

Re: Logging Hours of time spent watching movies.

aceospade
In reply to this post by aceospade

> Note the lack of any `Allocated` elements.
>
> Then, when you press the "Add Movie" button, you would copy a "empty
> movie allocation" template into the `TimeData` element above.  This
> template might be declared in an instance as follows:
>
>   <xf:instance id="allocationTemplate">
>     <Allocated xmlns="">
>       <Movie/>
>       <Hours/>
>     </Allocated>
>   </xf:instance>
>
> (Or you could have one instance that contains templates for any elements
> that need one.  I have used both approaches.  Also, this same type of
> design would apply to your default instance, as well, which starts off
> with two empty "templates".)
>
> Then you could set the movie value to what is selected (using an
> `xf:setvalue` action), and enter the hours for the movie in the field
> that would appear.  Each `Allocated` element contained within a
> `TimeData` element would correspond to one user entry.
>

Would this have any effect on what was submitted even if it was in a
separate instance? Would you still be able to add and delete movies
and still have them submitted? I have tried multiple instances before
but had trouble with submission. This way seems better because you do
not see empty templates in the submitted data. As far as the empty
Movie/Hours if the Allocated were in it's own instance would it still
show an empty input after the Add Movie was hit?

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

RE: Logging Hours of time spent watching movies.

Clark, John
Matthew,

> Would this have any effect on what was submitted even if it
> was in a separate instance?

Yes; you would no longer have portions of your data remain completely
empty.

> Would you still be able to add
> and delete movies and still have them submitted?

What might cause a problem with adding, deleting, or submitting the list
of movies?

> I have tried
> multiple instances before but had trouble with submission.

What kinds of trouble did you have?

> This way seems better because you do not see empty templates
> in the submitted data. As far as the empty Movie/Hours if the
> Allocated were in it's own instance would it still show an
> empty input after the Add Movie was hit?

Yes, but that would be the input that you are supposed to fill in.  The
best way to see the results of these decisions is to give it a try with
your form; I encourage you to experiment.

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.



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

Re: Logging Hours of time spent watching movies.

aceospade
In reply to this post by aceospade
As far as the multiple instances go, it was not only multiple
instances but multiple models. That is where it was getting confusing.
The separate instance for the Allocated would still need to be in the
same model. The relevant would be in a bind that related to
Time[position()!=last()] so it would show everything but the last one?
Ya know I think this is starting to make more and more sense everyday.
So the xf:copy would ref the allocationTemplate and then you would
call that in the repeat? Would you still have the labels and inputs
inside the repeat? What if I wanted to save off the data as a
different name than what is in the code? Like a Save As instead of a
Save? Is that possible? Once again thank you John for all of you help.
The form is working great. It would have taken me alot longer to try
and figure it out. Thank you 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: Logging Hours of time spent watching movies.

Clark, John
Matthew,

> As far as the multiple instances go, it was not only multiple
> instances but multiple models. That is where it was getting confusing.

Ah, yes, I believe multiple models can cause problems when you're trying
to copy from an instance in one model to an instance in another model.

> The separate instance for the Allocated would still need to
> be in the same model. The relevant would be in a bind that
> related to Time[position()!=last()] so it would show
> everything but the last one?

If you put your templates in a separate instance, that you wouldn't have
to worry about masking the template data using a `relevant` attribute;
however, if your template data is always the last element within a
particular parent, then you are close with that expression.  For masking
the template `TimeData` element, you would want an expression like
"TimeData[position()!=last()]".

> So the xf:copy would ref the allocationTemplate and then you
> would call that in the repeat? Would you still have the
> labels and inputs inside the repeat?

You'd want to use `xf:insert` instead of `xf:copy`, but yes, you could
call it in a repeat to insert a new item into the nodeset that the
repeat "covers".  Then, when the model is rebuilt, the repeat would
"see" the new node that matches its nodeset expression, and would
dynamically cover the new node as well (which is why the labels and
inputs inside the repeat would apply to the newly inserted node).

> What if I wanted to save
> off the data as a different name than what is in the code?
> Like a Save As instead of a Save? Is that possible?

It certainly is.  The basic formula is to prompt the user for the
location to save the data (for example, by using the unfortunately named
`xf:upload` control[0]); you would store that location in an instance
somewhere, then use the `xf:resource` child[1] of your `xf:submission`
to use the chosen location as the save location.

[0] http://www.w3.org/TR/2007/WD-xforms11-20070222/#ui-upload

[1] http://www.w3.org/TR/2007/WD-xforms11-20070222/#submit-resource

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.



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

Re: Logging Hours of time spent watching movies.

aceospade
In reply to this post by aceospade
Okay this part was added to the model:

<xf:instance id="save-as" xmlns="">
      <save-as>
           <File xsi:type="xs:anyURI"/>
      </save-as>
</xf:instance>

and then this part was added to the body with the submission.

<xf:submit submission="submit">
        <xf:label> Save </xf:label>
        <xf:resource value="child[1]"/>
</xf:submit>

<xf:upload ref="instance('save-as')/File" mediatype="text/xml"
nodeset="control[0]">
    <xf:filename>*.xml</xf:filename>
    <xf:mediatype>text/xml</xf:mediatype>
</xf:upload>

all this allows me to do is "Open" a file instead of "Save" a file.
>From the way I read your post and the way I read the specs this should
do the trick. Sorry to be such a bother with all of this. Thank you
again. I believe with a little cleaning up this one is almost
complete.
Have a wonderful day.
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: Logging Hours of time spent watching movies.

Clark, John
Matthew,

> Okay this part was added to the model:
>
> <xf:instance id="save-as" xmlns="">
>       <save-as>
>            <File xsi:type="xs:anyURI"/>
>       </save-as>
> </xf:instance>

This looks good.  You might want to have the `File` element contain a
default value, such as "moviez.xml", so you don't have any regression in
the default behaviour.

> and then this part was added to the body with the submission.
>
> <xf:submit submission="submit">
> <xf:label> Save </xf:label>
> <xf:resource value="child[1]"/>
> </xf:submit>

This is close, but not quite right.  It is the `xf:submission` element
itself which specifies where its output will go; in this case, it looks
like this:

  <xf:submission id="submit" ref="/Time" replace="none" method="put" >
    <xf:resource value="instance('save-as')/File"/>
  </xf:submission>

This declares that instead of "put"ing to the static location
"moviez.xml", the submission will put to whatever URI is stored in
"instance('save-as')/File".

> <xf:upload ref="instance('save-as')/File" mediatype="text/xml"
> nodeset="control[0]">
>     <xf:filename>*.xml</xf:filename>
>     <xf:mediatype>text/xml</xf:mediatype>
> </xf:upload>

And it turns out I was flat out wrong on this.  It looks like in the
Mozilla XForms Extension, the `xf:upload` control only allows you to
select existing local URIs.  I think this is an unnecessary restriction,
but in practice I don't plan on saving to the local filesystem from an
XForm that often, so I'm not going to complain too loudly.  :)

As a workaround, I replaced your `xf:upload` with a simple `xf:input`,
so you have to type in the (possibly relative) URI to which you want to
serialize your movie data:

  <xf:input ref="instance('save-as')/File">
    <xf:label>Save location: </xf:label>
  </xf:input>

I was then able to type in an alternate location, such as "moviez2.xml",
and the form serialized the movie data to that file when I pressed the
"Save" button.

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.



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

Re: Logging Hours of time spent watching movies.

Aaron Reed
In reply to this post by aceospade
Hi Matthew,

You still need me on this?  Or did John get you past this one, too?

--Aaron

aceospade wrote:

> This is what I have so far. What I was wondering was when the add
> movie button is hit and you put in the number of hours watched for
> that movie, how would you have those hours add up and print that total
> out? An example would be to select a movie and enter 2 for the hours
> the hit the button and select another movie and put 3 for the hours
> the the total would equal 5. So far I haven't been able to get any
> numbers to add up except for the begin, end and break times.
>
> <?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>
>
>         <style>
> .date .xf-value {width:70px;}
> .input .xf-value {width:38px;}
> html {overflow: -moz-scrollbars-vertical;}
> </style>
>
> <xf:model id="MovieModel">
> <xf:instance>
> <Time xmlns="">
> <TimeData>
> <Movie />
> <EntryDate />
> <StartTime />
> <StopTime />
> <BreakTime />
> <TotalEntryTime />
> <TotalHours />
> <Allocated>
> <Movie />
> <Hours />
> </Allocated>
> <Allocated>
> <Movie />
> <Hours />
> </Allocated>
> </TimeData>
> <TimeData>
> <Movie />
> <EntryDate />
> <StartTime />
> <StopTime />
> <BreakTime />
> <TotalEntryTime />
> <TotalHours />
> <Allocated>
> <Movie />
> <Hours />
> </Allocated>
> <Allocated>
> <Movie />
> <Hours />
> </Allocated>
> </TimeData>
> </Time>
> </xf:instance>
> <xf:instance id="movies" xmlns="">
> <data>
> <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>
> </data>
> </xf:instance>
>
> <xf:instance id="selected-movie" xmlns="">
> <movie-id xmlns="">A New Hope</movie-id>
> </xf:instance>
>
> <xf:instance id="selected" xmlns="">
> <movie-id xmlns="">Empire Strikes Back</movie-id>
> </xf:instance>
>
> <xf:bind nodeset="instance('movies')">
> <xf:bind nodeset="/data/Movie/Title" required="true( )" id="title" /
> <xf:bind nodeset="/data/Movie/Release" required="true( )"
> id="release" />
> <xf:bind nodeset="/data/Movie/Director" required="true( )"
> id="director" />
> <xf:bind nodeset="/data/Movie/Episode" required="true( )"
> id="episode" />
> <xf:bind nodeset="/data/Movie/Characters" required="true( )"
> id="characters" />
> </xf:bind>
>
>
> <xf:bind nodeset="/Time/TimeData/EntryDate" id="Date"
> required="true(  )" type="xsd:date" />
>
> <xf:bind nodeset="/Time/TimeData/TotalEntryTime"
> calculate="../StopTime - ../StartTime - ../BreakTime" />
>
> <xf:bind nodeset="/Time/TimeData/TotalHours" calculate="sum(/Time/
> TimeData/Allocated/Hours)" />
>
>  <xf:action ev:event="xforms-ready">
>           <xf:setfocus control="movieEntry" />
>       </xf:action>
>
>       <xf:action ev:event="xforms-ready">
>       <xf:rebuild model="MovieModel" />
>   </xf:action>
>
> <xf:submission id="submit" ref="/Time" action="moviez.xml"
> replace="none" method="put" />
>
> </xf:model>
>
> </head>
>
> <body>
>
> <xf:select1 ref="instance('selected-movie')">
> <xf:label>
> <b>Film: </b>
> </xf:label>
> <xf:itemset nodeset="instance('movies')/Movie/Title/@id">
> <xf:label ref="." />
> <xf:value ref="." />
> </xf:itemset>
> </xf:select1>
>
> <xf:group
> ref="instance('movies')/Movie[Title/@id = instance('selected-
> movie')]">
> <dl>
> <dt><b>Title: </b> <xf:output ref="Title/@id" /></dt>
> <dt><b>Release: </b> <xf:output ref="Release" /></dt>
> <dt><b>Director: </b> <xf:output ref="Director" /></dt>
> <dt><b>Episode: </b> <xf:output ref="Episode" /></dt>
> <dt><b>Characters: </b> <xf:output ref="Characters" /></dt>
> </dl>
> </xf:group>
>
> <xf:trigger>
> <xf:label>
> <b>Add an entry?</b>
> </xf:label>
> <xf:action ev:event="DOMActivate">
> <xf:insert nodeset="TimeData" at="index('TimeData-repeat')"
> position="after" />
> <xf:setfocus control="TimeData-repeat" />
> <xf:rebuild nodeset="TimeData" at="index('TimeData-repeat')" />
> </xf:action>
> </xf:trigger>
>
> <xf:trigger>
> <xf:label><b>Remove current entry?</b></xf:label>
> <xf:delete nodeset="TimeData[last()&gt;1]" at="index('TimeData-
> repeat')" />
> <xf:insert nodeset="TimeData[last()=1]" at="index('TimeData-
> repeat')" position="before" />
> </xf:trigger>
> <br />
> <br />
> <xf:repeat nodeset="TimeData[position()!=last()]" id="TimeData-
> repeat">
> <xf:label>Date: <xf:input ref="EntryDate" class="date" />&nbsp;</
> xf:label>
> <xf:label>Begin: <xf:input ref="StartTime" class="input" /></
> xf:label>
> <xf:label>End: <xf:input ref="StopTime" class="input" /></xf:label>
> <xf:label>Break: <xf:input ref="BreakTime" class="input" /></
> xf:label>
> <xf:label>Total: <xf:input ref="TotalEntryTime" class="input" /></
> xf:label>
> <xf:label>Total: <xf:input ref="TotalHours" class="input" /></
> xf:label>
>
> <br />
> <br />
> <xf:select1 ref="instance('selected')">
> <xf:label>
> <b>Film: </b>
> </xf:label>
> <xf:itemset nodeset="instance('movies')/Movie/Title/@id">
> <xf:label ref="." />
> <xf:value ref="." />
> </xf:itemset>
> </xf:select1>
> &nbsp; &nbsp;
> <xf:trigger>
> <xf:label>Add Movie</xf:label>
> <xf:action ev:event="DOMActivate">
> <xf:insert nodeset="Allocated[position()=index('newmovies-list')]"
> at="index('newmovies-list')" />
> <xf:setvalue ref="Allocated[index('newmovies-list')]/Movie"
> value="instance('movies')/Movie[Title/@id = instance('selected')]/
> Title/@id" />
> <xf:setfocus control="movieEntry" />
>             <xf:rebuild/>
>             <xf:refresh/>
> </xf:action>
> </xf:trigger>
>
> <xf:trigger>
> <xf:label>Delete Movie</xf:label>
> <xf:action ev:event="DOMActivate">
> <xf:delete nodeset="Allocated[last()&gt;1]"
> at="index('newmovies-list')" />
> <xf:insert nodeset="Allocated[last()=1]" at="index('newmovies-
> list')"
> position="after" />
> </xf:action>
> </xf:trigger>
> <xf:trigger>
> <xf:label>Recalculate</xf:label>
> <xf:action ev:event="DOMActivate">
> <xf:recalculate  model="MovieModel" nodeset="/Time/TimeData/
> Allocated/Hours" ref="TotalHours" />
> </xf:action>
> </xf:trigger>
>
> <br />
> <br />
>
> <xf:repeat id="newmovies-list" nodeset="Allocated[position()!
> =last()]">
> <xf:label>Movie: <xf:input ref="Movie" id="movieEntry" />
> </xf:label>
> <xf:label>Hours: <xf:input ref="Hours" />
> </xf:label>
> </xf:repeat>
> <br />
> </xf:repeat>
>
> <xf:submit submission="submit">
> <xf:label> Save </xf:label>
> </xf:submit>
>
> </body>
> </html>
>
> I have other questions that I still am not sure about but the hours is
> what is troubling me at the time.
> Thanks again,
> 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: Logging Hours of time spent watching movies.

aceospade
In reply to this post by aceospade
Like this?
<xf:instance id="save-as" xmlns="">
     <save-as>
           <File xsi:type="xs:anyURI" value="moviez.xml" />
     </save-as>
</xf:instance>


>   <xf:input ref="instance('save-as')/File">
>     <xf:label>Save location: </xf:label>
>   </xf:input>
>
> I was then able to type in an alternate location, such as "moviez2.xml",
> and the form serialized the movie data to that file when I pressed the
> "Save" button.

When I changed the submission data there was no Save button so I
couldn't get that to work. I put the Save button label back in and
then the only one that changed was moviez.xml and there was so sight
of moviez2.xml. Not sure why I thought I had everything right. I will
keep trying.
Thanks again,
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: Logging Hours of time spent watching movies.

aceospade
Thanks Aaron, John was able to get me through this one. Although I
still wasn't able to get what you were talking about John, as far as
the "Save As". I would however like to be able to Save As something
else though as far as file name. If it's not to much trouble would you
still be able to help me? I appreciate all of you guidance. How long
have you been doing XForms? What material did you learn the best
from?
Have a great day,
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: Logging Hours of time spent watching movies.

Clark, John
In reply to this post by aceospade
Matthew,

> Like this?
> <xf:instance id="save-as" xmlns="">
>      <save-as>
>            <File xsi:type="xs:anyURI" value="moviez.xml" />
>      </save-as>
> </xf:instance>

No, the submission's `xf:resource` element is currently set up to take the string value of the `File` element, so "moviez.xml" should be text content of that element:

<xf:instance id="save-as" xmlns="">
     <save-as>
           <File xsi:type="xs:anyURI">moviez.xml</File>
     </save-as>
</xf:instance>

> When I changed the submission data there was no Save button so I
> couldn't get that to work. I put the Save button label back in and
> then the only one that changed was moviez.xml and there was so sight
> of moviez2.xml. Not sure why I thought I had everything right. I will
> keep trying.

You added the input and entered the name "moviez2.xml" in that input?  It may be good to post an updated version of your form, so that we can see what's going on.

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.


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

RE: Logging Hours of time spent watching movies.

Clark, John
In reply to this post by aceospade
Matthew,

> Thanks Aaron, John was able to get me through this one. Although I
> still wasn't able to get what you were talking about John, as far as
> the "Save As". I would however like to be able to Save As something
> else though as far as file name. If it's not to much trouble would you
> still be able to help me?

Absolutely.  I'm confident that we can make it work.  :)

> I appreciate all of you guidance. How long
> have you been doing XForms? What material did you learn the best
> from?

I've been doing XForms for about 9 months, although I've been doing XSLT for about 4 years, and a great deal what you learn from XSLT can be applied to XForms (and vice-versa, I would imagine).  I'm a bit of a masochist in that I learn the best from the specifications themselves.

> Have a great day,

You too.

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.


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

Re: Logging Hours of time spent watching movies.

aceospade
In reply to this post by aceospade
The latest:

<?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>

<style>
        .date .xf-value {width:70px;}
        .input .xf-value {width:38px;}
        .errorReport:invalid { display: block; color: red; }
  .errorReport:valid { display: none; }
        html {overflow: -moz-scrollbars-vertical;}
</style>

<xf:model id="MovieModel">
        <xf:instance>
                <Time xmlns="">
                        <TimeData>
                                <EntryDate />
                                <StartTime />
                                <StopTime />
                                <BreakTime />
                                <TotalEntryTime />
                                <TotalHours />
                                <Allocated>
                                        <Movie />
                                        <Hours />
                                </Allocated>
                        </TimeData>

                        <TimeData>
                                <EntryDate />
                                <StartTime />
                                <StopTime />
                                <BreakTime />
                                <TotalEntryTime />
                                <TotalHours />
                                <Allocated>
                                        <Movie />
                                        <Hours />
                                </Allocated>
                        </TimeData>
                </Time>
        </xf:instance>

        <xf:instance id="movies" xmlns="">
                <data>
                        <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>
                </data>
        </xf:instance>

        <xf:instance id="selected-movie" xmlns="">
                <movie-id xmlns="">A New Hope</movie-id>
        </xf:instance>

        <xf:instance id="selected" xmlns="">
                <movie-id xmlns="">Empire Strikes Back</movie-id>
        </xf:instance>

        <xf:instance id="save-as" xmlns="">
           <save-as>
               <File xsi:type="xs:anyURI">moviez.xml"</File>
           </save-as>
        </xf:instance>

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

    <xf:bind nodeset="/Time/TimeData[position() &lt; last()]/
EntryDate"
    required="true()" type="xsd:date" />

                <xf:bind nodeset="TimeData/TotalEntryTime"
                        calculate="../StopTime - ../StartTime - ../BreakTime" />

                <xf:bind nodeset="/Time/TimeData/TotalHours"
                        calculate="sum(../Allocated[string(Movie)]/Hours)" />

                <xf:bind nodeset="/Time/TimeData[position() &lt;last()]/
TotalEntryTime"
                  constraint=". = ../TotalHours" />

          <xf:action ev:event="xforms-ready">
          <xf:setfocus control="movieEntry" />
      </xf:action>

      <xf:action ev:event="xforms-ready">
      <xf:rebuild model="MovieModel" />
  </xf:action>

        <xf:submission id="submit" ref="/Time" action="moviez.xml"
                replace="none" method="put" />

</xf:model>

</head>

<body>

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


<xf:group
        ref="instance('movies')/Movie[Title/@id = instance('selected-
movie')]">
        <dl>
                <dt><b>Title: </b> <xf:output ref="Title/@id" /></dt>
                <dt><b>Release: </b> <xf:output ref="Release" /></dt>
                <dt><b>Director: </b> <xf:output ref="Director" /></dt>
                <dt><b>Episode: </b> <xf:output ref="Episode" /></dt>
                <dt><b>Characters: </b> <xf:output ref="Characters" /></dt>
        </dl>
</xf:group>

        <xf:trigger>
                <xf:label>
                        <b>Add an entry?</b>
                </xf:label>
                <xf:action ev:event="DOMActivate">
                        <xf:insert nodeset="TimeData" at="index('TimeData-repeat')"
position="after" />
                        <xf:setfocus control="TimeData-repeat" />
                        <xf:rebuild nodeset="TimeData" at="index('TimeData-repeat')" />
                </xf:action>
        </xf:trigger>

        <xf:trigger>
                <xf:action ev:event="DOMActivate">
                        <xf:label><b>Remove current entry?</b></xf:label>
                        <xf:delete nodeset="TimeData[last()&gt;1]" at="index('TimeData-
repeat')" />
                        <xf:insert nodeset="TimeData[last()=1]" at="index('TimeData-
repeat')" position="before" />
                </xf:action>
        </xf:trigger>
        <br />
        <br />
<xf:repeat nodeset="TimeData[position()!=last()]" id="TimeData-
repeat">
        <xf:label>Date: <xf:input ref="EntryDate" class="date" />&nbsp;</
xf:label>
        <xf:label>Begin: <xf:input ref="StartTime" class="input" /></
xf:label>
        <xf:label>End: <xf:input ref="StopTime" class="input" /></xf:label>
        <xf:label>Break: <xf:input ref="BreakTime" class="input" /></
xf:label>
        <xf:label>Total: <xf:input ref="TotalEntryTime" class="input" /></
xf:label>

        <br />
        <br />
        <xf:select1 ref="instance('selected')">
                <xf:label>
                        <b>Film: </b>
                </xf:label>
                <xf:itemset nodeset="instance('movies')/Movie/Title/@id">
                        <xf:label ref="." />
                        <xf:value ref="." />
                </xf:itemset>
        </xf:select1>
&nbsp; &nbsp;
        <xf:trigger>
                <xf:label>Add Movie</xf:label>
                <xf:action ev:event="DOMActivate">
                        <xf:insert nodeset="Allocated[position()=index('newmovies-list')]"
                                at="index('newmovies-list')" />
                        <xf:setvalue ref="Allocated[index('newmovies-list')]/Movie"
                                value="instance('movies')/Movie[Title/@id = instance('selected')]/
Title/@id" />
                        <xf:setfocus control="movieEntry" />
            <xf:rebuild/>
            <xf:refresh/>
                </xf:action>
        </xf:trigger>

        <xf:trigger>
                <xf:label>Delete Movie</xf:label>
                <xf:action ev:event="DOMActivate">
                        <xf:delete nodeset="Allocated[position()!=last()]"
at="index('newmovies-list')" />
                </xf:action>
        </xf:trigger>

        <xf:trigger>
                <xf:label>Recalculate</xf:label>
                <xf:action ev:event="DOMActivate">
                        <xf:recalculate />
                        <xf:refresh />
                </xf:action>
        </xf:trigger>

        <br />
        <br />
<table>
<tr>
<td>
        <xf:repeat id="newmovies-list" nodeset="Allocated">
                <xf:label>Movie: <xf:input ref="Movie" id="movieEntry" />
                </xf:label>
                <xf:label>Hours: <xf:input ref="Hours" />
                </xf:label>
        </xf:repeat></td>
        <td><xf:label>Total: <xf:input ref="TotalHours" class="input" /></
xf:label></td>
        <td><xf:group ref="TotalEntryTime" class="errorReport">
    <b>Your times don't add up!</b>
  </xf:group></td>
  </tr>
  </table>
        <br />
</xf:repeat>

<xf:submission id="submit" ref="/Time" replace="none" method="put" >
  <xf:resource value="instance('save-as')/File"/>
</xf:submission>

<xf:input ref="instance('save-as')/File">
  <xf:label>Save location: </xf:label>
</xf:input>

</body>
</html>

Thank you and have a great day,
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: Logging Hours of time spent watching movies.

Clark, John
Matthew,

> <xf:submission id="submit" ref="/Time" replace="none" method="put" >
>   <xf:resource value="instance('save-as')/File"/>
> </xf:submission>

You have placed the `xf:submission` element in the body of your form; `xf:submission` elements are only effective when they are declared in the model.  In your previous version of the form, you had the submission in the model; a submission in the model defines a submission target.  To actually initiate the submission, you use the `xf:send` action[0] or the `xf:submit` control[1] (which the last version of your form had).

[0] http://www.w3.org/TR/xforms11/#action-send

[1] http://www.w3.org/TR/xforms11/#ui-submit

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.


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