styling xforms using css to make your forms look great date: 10/9/2008 dan mccreary president dan...

14
Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates [email protected] m (952) 931-9198 M D Metadata Solutions

Upload: everett-nash

Post on 29-Dec-2015

215 views

Category:

Documents


1 download

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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