styling xforms using css to make your forms look great date: 10/9/2008 dan mccreary president dan...
TRANSCRIPT
![Page 1: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/1.jpg)
Styling XFormsUsing CSS to make your forms look great
Date: 10/9/2008
Dan McCrearyPresidentDan McCreary & [email protected](952) 931-9198
M
D
Metadata Solutions
![Page 2: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/2.jpg)
Copyright 2008 Dan McCreary & Associates 2
M
D
Outline
• Why use CSS?
• XForms namespaces
• Field alignment
• Changing control dimensions
![Page 3: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/3.jpg)
Copyright 2008 Dan McCreary & Associates 3
M
D
Why CSS?
• XForms is a w3c standard
• CSS is a w3c standard
• Don’t reinvent the wheel
![Page 4: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/4.jpg)
Copyright 2008 Dan McCreary & Associates 4
M
D
Background
• Web form layout is different from paper form layout
• Paper forms we designed to reduce the amount of paper needed
• Forms were “dense”
• Online users want clear labels, hints, examples and hints
![Page 5: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/5.jpg)
Copyright 2008 Dan McCreary & Associates 5
M
D
Challenges
• One of the most difficult part about learning XForms is learning CSS
• Option: use someone else’s XForms stylesheets
![Page 6: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/6.jpg)
Copyright 2008 Dan McCreary & Associates 6
M
D
XForms Namespace
@namespace xf url("http://www.w3.org/2002/xforms");
…
xf|input {}
Note that the “:” is already in use.
![Page 7: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/7.jpg)
Copyright 2008 Dan McCreary & Associates 7
M
D
Terminology
• Label – the text that identifies a control
• Control Value – the area that the user enters the data
![Page 8: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/8.jpg)
Copyright 2008 Dan McCreary & Associates 8
M
D
Simple Form Layout
• Labels• Control Values
![Page 9: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/9.jpg)
Copyright 2008 Dan McCreary & Associates 9
M
D
Layout issues
• Wide full-text descriptions
• Selection lists
![Page 10: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/10.jpg)
Copyright 2008 Dan McCreary & Associates 10
M
D
Block Controls
/* All form controls appear on their own line with a 5px margin above and below between controls */
xf|input, xf|select, xf|select1, xf|textarea {
display:block;
width:100%;
margin:5px 0;
}
Margin above and below. Margin left and right.
![Page 11: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/11.jpg)
Copyright 2008 Dan McCreary & Associates 11
M
D
Right Align Labels
xf|input > xf|label,xf|select > xf|label,xf|select1 > xf|label,xf|textarea > xf|label { text-align:right; padding-right:10px;}
![Page 12: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/12.jpg)
Copyright 2008 Dan McCreary & Associates 12
M
D
Select1 and Inputs
• You can adjust the vertical separation
![Page 13: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/13.jpg)
Copyright 2008 Dan McCreary & Associates 13
M
D
Required Field Options
/* Differentiate between required fields and non-required fields */xf|input:required {font-weight: bold;}
xf|input:required .xf-value {background-color: yellow;}
/* This adds a red asterisk after the required input fields */*:required::after {font-weight:bold; font-size:1.5em; content: "*";
color: red; }
![Page 14: Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198](https://reader036.vdocuments.net/reader036/viewer/2022082710/56649e755503460f94b76a8a/html5/thumbnails/14.jpg)
Copyright 2008 Dan McCreary & Associates 14
M
D
Thank You!
Please contact me for more information:• Native XML Databases• Metadata Management• Metadata Registries• Service Oriented Architectures• Business Intelligence and Data Warehouse• Semantic Web
Dan McCreary, PresidentDan McCreary & Associates
Metadata Strategy [email protected]
(952) 931-9198