.xforms-invalid CSS class?

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

.xforms-invalid CSS class?

Adrian Baker-2
Although OPS has support for the disabled, readonly & required
pseudo-classes via xforms-disabled, xforms-readonly & xforms-required
(yay), it seems to be lacking support for the invalid pseudoclass
('xforms-invalid'). Looking at xforms.js it seems like the logic is in
place already - I'm assuming this is just something that just hasn't
been done yet, rather than a deliberation omission?

Say for example you wanted to give an invalid input field a red border
for example: without the .xforms-invalid class this isn't possible.

The other missing class is xforms-out-of-range
(http://www.w3.org/TR/2005/PER-xforms-20051006/sliceF.html#id160672),
although I'm not sure this is so straightforward to add.



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: .xforms-invalid CSS class?

Adrian Baker-2
With three minor changes I was able to add support for xforms-invalid.

[1] In org.orbeon.oxf.xforms.processor.handlers.HandlerBase, added
output of xforms-invalid class:

public static void handleMIPClasses(...) {
            ....
            if (!controlInfo.isValid())) {
                if (sb.length() > 0)
                    sb.append(' ');
                sb.append("xforms-invalid");
            }
       ...
}

[2] In xforms.js, added inital value for control.isValid based on
presence of xforms-invalid class:

function xformsInitializeControlsUnder(root) {

            // Set initial values for disabled, readonly, and required
            if (xformsArrayContains(classes, "xforms-control")) {
                control.isRelevant = !xformsArrayContains(classes,
"xforms-disabled");
                control.isReadonly = xformsArrayContains(classes,
"xforms-readonly");
                control.isRequired = xformsArrayContains(classes,
"xforms-required");
                control.isValid = !xformsArrayContains(classes,
"xforms-invalid");  // NEW
            }

[3] In xforms-style.js added 'valid' boolean parameter to
xformsUpdateStyleRelevantReadonly (all calls were updated to pass in
control.isValid to this parameter):

function xformsUpdateStyleRelevantReadonly(element, relevant, readonly,
required, valid) {
    if (xformsIsDefined(valid)) {
       if (valid) xformsRemoveClass(element, "xforms-invalid")
       else xformsAddClass(element, "xforms-invalid");
    }
    ...
}

Adrian

Adrian Baker wrote:

> Although OPS has support for the disabled, readonly & required
> pseudo-classes via xforms-disabled, xforms-readonly & xforms-required
> (yay), it seems to be lacking support for the invalid pseudoclass
> ('xforms-invalid'). Looking at xforms.js it seems like the logic is in
> place already - I'm assuming this is just something that just hasn't
> been done yet, rather than a deliberation omission?
>
> Say for example you wanted to give an invalid input field a red border
> for example: without the .xforms-invalid class this isn't possible.
>
> The other missing class is xforms-out-of-range
> (http://www.w3.org/TR/2005/PER-xforms-20051006/sliceF.html#id160672),
> although I'm not sure this is so straightforward to add.
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: .xforms-invalid CSS class?

Alessandro  Vernet
Administrator
Hi Adrian,

The changes you suggest make sense. I have checked them in, and they
are now integrated in the latest builds. Let us know if you discover
any issue with those changes, and thank you for sharing this code with
us.

Alex

On 2/26/06, Adrian Baker <[hidden email]> wrote:

> With three minor changes I was able to add support for xforms-invalid.
>
> [1] In org.orbeon.oxf.xforms.processor.handlers.HandlerBase, added
> output of xforms-invalid class:
>
> public static void handleMIPClasses(...) {
>             ....
>             if (!controlInfo.isValid())) {
>                 if (sb.length() > 0)
>                     sb.append(' ');
>                 sb.append("xforms-invalid");
>             }
>        ...
> }
>
> [2] In xforms.js, added inital value for control.isValid based on
> presence of xforms-invalid class:
>
> function xformsInitializeControlsUnder(root) {
>
>             // Set initial values for disabled, readonly, and required
>             if (xformsArrayContains(classes, "xforms-control")) {
>                 control.isRelevant = !xformsArrayContains(classes,
> "xforms-disabled");
>                 control.isReadonly = xformsArrayContains(classes,
> "xforms-readonly");
>                 control.isRequired = xformsArrayContains(classes,
> "xforms-required");
>                 control.isValid = !xformsArrayContains(classes,
> "xforms-invalid");  // NEW
>             }
>
> [3] In xforms-style.js added 'valid' boolean parameter to
> xformsUpdateStyleRelevantReadonly (all calls were updated to pass in
> control.isValid to this parameter):
>
> function xformsUpdateStyleRelevantReadonly(element, relevant, readonly,
> required, valid) {
>     if (xformsIsDefined(valid)) {
>        if (valid) xformsRemoveClass(element, "xforms-invalid")
>        else xformsAddClass(element, "xforms-invalid");
>     }
>     ...
> }
>
> Adrian
>
> Adrian Baker wrote:
> > Although OPS has support for the disabled, readonly & required
> > pseudo-classes via xforms-disabled, xforms-readonly & xforms-required
> > (yay), it seems to be lacking support for the invalid pseudoclass
> > ('xforms-invalid'). Looking at xforms.js it seems like the logic is in
> > place already - I'm assuming this is just something that just hasn't
> > been done yet, rather than a deliberation omission?
> >
> > Say for example you wanted to give an invalid input field a red border
> > for example: without the .xforms-invalid class this isn't possible.
> >
> > The other missing class is xforms-out-of-range
> > (http://www.w3.org/TR/2005/PER-xforms-20051006/sliceF.html#id160672),
> > although I'm not sure this is so straightforward to add.
> >
> >
> >
> > ______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security System.
> > For more information please visit http://www.messagelabs.com/email
> > ______________________________________________________________________
> > ------------------------------------------------------------------------
> >
> >
> > --
> > You receive this message as a subscriber of the [hidden email] mailing list.
> > To unsubscribe: mailto:[hidden email]
> > For general help: mailto:[hidden email]?subject=help
> > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
> >
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet