getting a date picker widget for a date field

The tutes say to bind the field to an xsd:date to get a date picker. I do
that. The example works fine for static pages. Great.

However when I try to incorporate this into my form, where the instance is
loaded dynamically like this:

      <xf:submission action="retrieve.php" method="post" replace="instance"
instance="mydata" id="retrieve" />

I get the form and data filled out fine, but no date picker for date fields.
Ok so maybe I need to bind after the submit is done, so I add this:

      <xf:send submission="retrieve">
        <xf:action ev:event="xforms-submit-done" ev:observer="retrieve">
          <xf:setvalue ref="instance('state')/gradingcriteria"
value="instance('sumo')/gradingcriteria" />
          <xf:bind
nodeset="instance('mydata')/assesstasks/assesstask/assessdue"
type="xsd:date" />
          <xf:bind nodeset="instance('mydata')/references"
type="xsd:boolean" />
        </xf:action>
      </xf:send>

This doesn't work either.

What am I doing wrong? Am I specifying the wrong event for the action? Maybe
I should wait until the instance is loaded to do the bind?

Thanks in advance.

-- 
View this message in context: http://www.nabble.com/getting-a-date-picker-widget-for-a-date-field-tp16831751p16831751.html
Sent from the Mozilla - XForms mailing list archive at Nabble.com.

0
Ken
4/23/2008 6:13:25 AM
mozilla.dev.tech.xforms 695 articles. 0 followers. Post Follow

6 Replies
651 Views

Similar Articles

[PageSpeed] 29

On Apr 23, 2:13 pm, Ken Yap <ken_...@y7mail.com> wrote:
> The tutes say to bind the field to an xsd:date to get a date picker. I do
> that. The example works fine for static pages. Great.
>
> However when I try to incorporate this into my form, where the instance is
> loaded dynamically like this:
>
>       <xf:submission action="retrieve.php" method="post" replace="instance"
> instance="mydata" id="retrieve" />
>
> I get the form and data filled out fine, but no date picker for date fields.
> Ok so maybe I need to bind after the submit is done, so I add this:
>
>       <xf:send submission="retrieve">
>         <xf:action ev:event="xforms-submit-done" ev:observer="retrieve">
>           <xf:setvalue ref="instance('state')/gradingcriteria"
> value="instance('sumo')/gradingcriteria" />
>           <xf:bind
> nodeset="instance('mydata')/assesstasks/assesstask/assessdue"
> type="xsd:date" />
>           <xf:bind nodeset="instance('mydata')/references"
> type="xsd:boolean" />
>         </xf:action>
>       </xf:send>
>
> This doesn't work either.
>
> What am I doing wrong? Am I specifying the wrong event for the action? Maybe
> I should wait until the instance is loaded to do the bind?
>
> Thanks in advance.
>
> --
> View this message in context:http://www.nabble.com/getting-a-date-picker-widget-for-a-date-field-t...
> Sent from the Mozilla - XForms mailing list archive at Nabble.com.

You've probably already checked, but you aren't forgetting your xsd
declaration are you?
<html
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
0
dr
4/23/2008 2:52:13 PM
> You've probably already checked, but you aren't forgetting your xsd
> declaration are you?
> <html
> xmlns:xf="http://www.w3.org/2002/xforms"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"

Yes, it's at the top of the xform.

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/
2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/
1999/xlink">

Should those NS declarations also be in instance data?
0
etherboot
4/24/2008 9:13:21 AM
I'd have to see your form to know why it is going wrong, but I verified 
here that replacing a stubbed out instance with a full instance worked 
just fine and a datepicker was generated.

Remember that xf:bind isn't an action.  It lives in a xf:model and has 
no meaning outside of xf:model.  So your xf:bind's will have to live in 
the document prior to the instance replacement.  You could always use 
xsi:type="xsd:date" directly on the instance or applied to the instance 
via schema if you don't want to use xf:binds.

--Aaron

Ken Yap wrote:
> The tutes say to bind the field to an xsd:date to get a date picker. I do
> that. The example works fine for static pages. Great.
> 
> However when I try to incorporate this into my form, where the instance is
> loaded dynamically like this:
> 
>       <xf:submission action="retrieve.php" method="post" replace="instance"
> instance="mydata" id="retrieve" />
> 
> I get the form and data filled out fine, but no date picker for date fields.
> Ok so maybe I need to bind after the submit is done, so I add this:
> 
>       <xf:send submission="retrieve">
>         <xf:action ev:event="xforms-submit-done" ev:observer="retrieve">
>           <xf:setvalue ref="instance('state')/gradingcriteria"
> value="instance('sumo')/gradingcriteria" />
>           <xf:bind
> nodeset="instance('mydata')/assesstasks/assesstask/assessdue"
> type="xsd:date" />
>           <xf:bind nodeset="instance('mydata')/references"
> type="xsd:boolean" />
>         </xf:action>
>       </xf:send>
> 
> This doesn't work either.
> 
> What am I doing wrong? Am I specifying the wrong event for the action? Maybe
> I should wait until the instance is loaded to do the bind?
> 
> Thanks in advance.
> 
0
Aaron
4/24/2008 7:14:07 PM
Ok, I did put the bind in the wrong place, should not have been inside
the action. However now I get validation errors. That's my fault
because I want the date picker but also I want the constraint to be
only advisory. Do I have to wait for XForms 1.1 to get this? Can I
have the date picker and yet the field allows non-dates? There is one
other allowed phrase for this field and this constraint is checked in
the backend.
0
etherboot
4/25/2008 11:32:54 PM
Well, if you can't write the rule completely in schema that can be
loaded by the form, then you'll have to 'cheat'.  And by cheat I mean
that what you want to do is doable, but it'll only work in the Mozilla 
xforms processor.  Remember that XForms UI is supposed to be up to the 
processor based on the XForm markup and the datatype of instance data. 
What you are trying to do is to specify which UI widgets you want to see 
rather than leaving that decision up to the processor.  Again, this is 
doable inside the Mozilla XForms processor but don't expect it to work 
on other processors.  Of course other processors might allow something 
similar.

Here is an example of using a datepicker widget for a xf:input bound to 
an instance node of type xsd:string:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ev="http://www.w3.org/2001/xml-events"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xforms="http://www.w3.org/2002/xforms"
       xmlns:foo="http://www.example.com">
   <head>
     <style>
       @namespace url(http://www.w3.org/1999/xhtml);
       @namespace xf url(http://www.w3.org/2002/xforms);
       @namespace mozType 
url(http://www.mozilla.org/projects/xforms/2005/type);

 
xf|input[mozType|typelist~="http://www.w3.org/2001/XMLSchema#string"] {
         -moz-binding: 
url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-date');
       }
 
xf|input[mozType|typelist~="http://www.w3.org/2001/XMLSchema#string"] 
span[mozType|calendar] {
         -moz-binding: 
url('chrome://xforms/content/widgets-xhtml.xml#calendar-full');
         z-index: 2147481647;
       }
     </style>
     <title>Datepicker bound to string testcase</title>
     <xforms:model>
       <xforms:instance xmlns="">
         <person>
           <date>2005-01-16</date>
         </person>
       </xforms:instance>
       <xforms:bind nodeset="/person/date" type="xsd:string"/>
     </xforms:model>
   </head>
   <body>
     <h2> This should show a date picker control
     </h2>
     <xforms:input class="myType" ref="/person/date">
       <xforms:label>Date: </xforms:label>
     </xforms:input>
     <xforms:output ref="/person/date">
       <xforms:label>Bound Date: </xforms:label>
     </xforms:output>
   </body>
</html>

--Aaron

etherboot@gmail.com wrote:
> Ok, I did put the bind in the wrong place, should not have been inside
> the action. However now I get validation errors. That's my fault
> because I want the date picker but also I want the constraint to be
> only advisory. Do I have to wait for XForms 1.1 to get this? Can I
> have the date picker and yet the field allows non-dates? There is one
> other allowed phrase for this field and this constraint is checked in
> the backend.

0
Aaron
4/28/2008 8:46:44 PM
On Apr 29, 6:46 am, Aaron Reed <aar...@us.ibm.com> wrote:
> Well, if you can't write the rule completely in schema that can be
> loaded by the form, then you'll have to 'cheat'.  And by cheat I mean
> that what you want to do is doable, but it'll only work in the Mozilla
> xforms processor.  Remember that XForms UI is supposed to be up to the
> processor based on the XForm markup and the datatype of instance data.
> What you are trying to do is to specify which UI widgets you want to see
> rather than leaving that decision up to the processor.  Again, this is
> doable inside the Mozilla XForms processor but don't expect it to work
> on other processors.  Of course other processors might allow something
> similar.

Ok thanks, I'll keep that in mind. I'll have a think about it. Maybe
we'll give the user another box saying I want the date to be the other
accepted value which is the phrase "See submission instructions".
Actually we are trying to get them to always put valid dates in the
field for the sake of reporting and collating, but sometimes they want
things like: one week after end of practicals, and the "See..." is an
escape clause. If I can trap validation errors on this field and tell
the user to put a good date or use the special box, it might be
possible to return this element to xsd:date.
0
etherboot
4/29/2008 1:03:21 AM
Reply:

Similar Artilces:

Dates, Dates, Dates!
Hello all... I am in the process of building an appointment system, and I am trying to see if I can get some pointers on which way to go on this. The first version of this appointment system was very lo-tech, and it stored all of the possible dates/times in the database. Once a user booked an appointment, their information was logged to that date/time, and then that date/time would no longer show in the list of possible openings. This was great for a temporary fix, but with having to pre-populate all of the dates/times, the system would eventually have to be updated to continue on pa...

get a date from two date field
how to use a stored procedure to get a date which is start_date + due_date. stare_date and due_date are data field. dats type are smalldatetime. database is SQL 2000.   Give an example of what you want..... Do you want something like 12/12/2005 12/25/2005 ? Eric RamseurRainbow Portal 2.0 AdminDownload Rainbow 2.0!!Rainbow Code Rainbow Portal CommunityC# 2005 Group I need a date, 60 days before start date +  due days. For example, start is 12/03/2005(smalldatetime) Due days is 20(int).   start date + due day - 60 is 10/23/2005. that's what I...

date field = date
i made an news table and i made and option to add and update and delete news from it i need one thing that when someone try to add news the time that he insert the news will be in teh date field of the table and dont the costumer write it   hope that u understand me Hi, did you mean you want to add a column that get current date as its value automaticly? If so, you can do the following in Access2003: 1. add a column with 'Date/Time' data time 2. In the 'Field Properties'->'General' pannel, add a 'Default Value' for it, 3. In the 'Expression Builder', double cli...

No date in Date field
I have just installed thunderbird on my system. I migrated from outlook express. All the mail that was there before shows both the date and the time in the date field. However, all mail received by thunderbird only has a time stamp, no date. How do I correct this?? Thanks, Roger _Roger Bailey_ spoke thusly on 29/08/2006 10:09 PM: > I have just installed thunderbird on my system. I migrated from outlook > express. All the mail that was there before shows both the date and the > time in the date field. However, all mail received by thunderbird only has ...

from date to date
I am working on a form for livestock. one of the things in the form is a checkbox to let me know if they qualify or not. the second is I have a created record field entered into the database... now my question is I am doing a search on this and cant figure it out since i am new to all this...i have a query that selects the qualification checkbox (where qualify = 'true') then another query that selects the created record date... and the search is that I want to get the information in the livestock that are qualifyed (have the checkbox qualify = to 'true') between  one dat...

From Date and To Date
 In my application i have two textboxes.One for From date and the other one for To date.I need to check whether the From date is lesser than To Date..Date formats will be either(DD-MM-YYYY) or (DD/MM/YYYY).and i have used calendar extender for selecting dateI need the script code to do this...Thanks in advance See this thread: http://forums.asp.net/t/1346328.aspxMohsin Naeem"Please mark as answer if it helped you"  <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </...

Getting dates between 2 dates
Hi all, Would like to make an enquiry, if i have 2 dates, how can can i get all the dates between these 2 dates. Thanks for the help.   You will probably need to loop through the dates;               DateTime startdate;            DateTime enddate;            List<DateTime> allDates = new List<DateTime>();            allDates.Add(startdate);         ...

Get the dates between two dates
Hi all, I want to get all the date between two dates. For example I have a StartDate="12/5/2003" and a EndDate="12/7/2003" the result should be 12/5/2003 12/6/2003 12/7/2003 Ant help is appreciated Thanks for ( DateTime theDate=StartDate ; theDate<=EndDate ; theDate.AddDays(1) ) { // Do something...theDate.ToShortDate() would give the string... } Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog I get a syntax error as :"For loop variable cannot be of type Date" Hmm. The below work...

comparing date field with date
Dear sir, I am trying to get data from database using dataadapter. My querry string is string querystring="Select * from candidate where DateOfBirth > " +DateMin +""; DateMin is a dateTime variable carrying date value. DateOfBirth is the field name intable candidate. I have tried various versions for querystring. Each time error is thrown mostly syntex error. Kindly help me to form the querystring correctly.   Thanking in advance, pcg You should never, under no circumstances, pass SQL code on the query string. That's like leaving your house for vac...

getting date in between 2 date
how do i get the date in if it is within the 2 date? er... don't know how to phrase i think my sql is something like this: SELECT * From Transaction WHERE Date BETWEEN 01/08/1900 AND 31/08/2000 BTW i declare my Date as date/time(short date) is it possible with the sql? it display Syntax error in FROM clause. SELECT * From [Transaction] WHERE [Date] BETWEEN #01/08/1900# AND #31/08/2000# Now, this presumes that the machine in question is expecting dates in dd/mm/yyyy format. Note that Transaction and Date are likely reserved words, and so I have enclosed them in [ and ...

Date Field(Current Date)
I have a field which I set type to date and value to current date. When I add records to the db via a LOAD TABLE with DEFAULTS ON, and then do a select for the DISTINCT dates, I get the same date appearing more than once in the list, if I've loaded the table more than once on that day. The DB seems to insert the same date, it looks distinct... (see below) I'm not using timestamp, so I don't see what would be different in the date field. 2000-08-07 2000-08-08 2000-08-09 2000-08-09 What version are you running? If it's earlier than 7.0, this is expecte...

DATE field to DATE/TIME
Hello, If the field is defined as a DATE and you do: select datefield+1 from mytable Does the ODBC API (actually ASA 9.02 backend) return a field that is DATETIME or a DATE field? It is messing up my compiled application and seems to be coming back as DATETIME. Thank you. -Robert You are correct, the value is being returned as a TIMESTAMP. You can verify this through using the EXPRTYPE() builtin function, as in select exprtype('select datefield+1 from mytable', 1) from dummy which will return TIMESTAMP. Exprtype is documented in the help. You alm...

Default date in date field
I have an .aspx file with an input form linked to an MS Access database.  The date field receives a value of yesterday's date except for Monday which will have input for Friday, Saturday and Sunday. I'd like to have a default date of yesterday in the date field but also the ability to change it.  Is there a place in the properties to set the default date or must it be done in the code? I'm not sure about the property, but you could certainly have it set in the code behind like this on page_load... this.txtDateBox.text = DateTime.Now.AddDays(-1).ToShortDateAsString...

Setting the date on a date field
Hello, How do I get SQL server to insert the current date on inserting a record in a field of datetime? Thanks GrantGrant Krieger cmd.Parameters("@Date").Value = DateTime.NowSushila Bowalekar PatelVisual ASP/ASP.NET MVPhttp://weblogs.asp.net/sushilasb Alternately, you could set the Default value of the column to GETDATE(). This would put the current datetime of the SQL Server into the column. TerriTerri MortonEngagement Manager, NeudesicHow to ask a question...

Web resources about - getting a date picker widget for a date field - mozilla.dev.tech.xforms

In Wake Of Planned Parenthood Shootings, Anti-Abortion Activists Who Incite Violence Criticized
In wake of the deadly shootings at the Planned Parenthood clinic in Colorado Springs, anti-abortion activists, as well as Republican politicians, ...

Mann Ki Baat: Fight against climate change is responsibility of all, says PM Narendra Modi
PM Narendra Modi asked people to adopt energy conservation and energy efficiency measures like the maximum use of solar-powered items.

The Best Suction Cup Smartphone Mount is Cheaper Than Ever for Cyber Monday
The followup to your favorite smartphone car mount is down to just $14 today on Amazon, which is the best price we’ve ever seen. While magnetic ...

Turkey to hand over body of dead Russian pilot to Moscow: PM
The body of a Russian pilot killed when his plane was shot down by Turkey last week will be handed over to a Russian representative after being ...

Coco Austin And Ice-T Welcome Baby Chanel Nicole! See The Adorable First Photos Here!
Coco Austin and Ice-T have welcomed their baby daughter to the world – and the adorable infant already has her own social media accounts with ...

Ben Carson on Syrian Crisis: 'Look at What Has Worked'
NBCNews.com Ben Carson on Syrian Crisis: 'Look at What Has Worked' NBCNews.com Fresh off of a visit to the Syrian refugee camps in Jordan, ...

Donald Trump Stands By 9/11 Cheering Claims
Despite a lack of evidence, GOP presidential candidate Donald Trump on Sunday kept pushing the claim that he saw cheering from Muslims in New ...

Hayden Panettiere Makes First Public Appearance at Wladimir Klitschko's Fight After Postpartum Depression ...
Hayden Panettiere is smiley and gorgeous as she attends the IBF IBO WBA WBO Heavyweight World Championship Fight at Esprit-Arena on Saturday ...

Pope Francis speaks of peace in war-torn Central African Republic
NOLA.com Pope Francis speaks of peace in war-torn Central African Republic NOLA.com BANGUI, Central African Republic — Pope Francis arrived ...

Republican Christie wins major endorsement in presidential race
By Alana Wise WASHINGTON (Reuters) - U.S. Republican Chris Christie has won the endorsement of the New Hampshire Union Leader, a major conservative ...

Resources last updated: 11/29/2015 6:54:01 PM