Re: [Chiba-users] displaying certain alert depending on userinput
Creators discontinued Chiba & founded betterFORM http://betterform.de
Brought to you by:
chibaxforms,
windauer
From: joern t. <joe...@we...> - 2004-03-31 21:23:32
|
hello Anja, anja wrote: > hello joern, > > thanx for your answer and your suggestion with setvalue. > you wrote, i could set the value of the alert before revalidate, if that's > possible. > well, i could set the value, but i still don't see, how i could make this > value depend on what the user did input? > please excuse if i'm being kind of blind here for an obvious solution and > thanx for any more hints. :) no, you're not a newbie any more from the question and constructive input you already gave and you also didn't missed the obvious solution. the truth is that i've hoped to squeeze some good idea for this out of you ;) i confess that i don't have a readymade answer here but its definitely an interesting issue. maybe there's a solution with events but i've to think about .... Joern > > regards, > anja > > > > >>>i'm trying to display a certain alert-message, depending on the user > > input. > >>>e.g. if a field is required and there's also a constraint on it: >>> - in case the user didn't input anything --> display alert1, >>> - in case the user did input something, but the input is invalid >>>considering the constraint --> display alert2. >> >>interesting case. never really thought about this. >> >> >>>i've tried with binding like this: (see complete sample below) >>>--- >>><xforms:bind id="bAlertEmpty" >>>nodeset="instance('instance01')/alert/emailEmpty" >>>relevant="string-length(instance('instance01')/email)=0"/> >>> <xforms:bind id="bAlertInvalid" >>>nodeset="instance('instance01')/alert/emailInvalid" >>>relevant="string-length(instance('instance01')/email) > 0"/> >>> >>><xforms:alert><xforms:output xforms:bind="bAlertInvalid"/><xforms:output >>>xforms:bind="bAlertEmpty"/></xforms:alert> >>>-- >>> >>>but it won't work, instead it will always display both alerts. >>> >>>i'm not quite sure, whether this would be correct syntax according to >>>xforms-spec, anyway. >> >>when reading the XForms schema your syntax should be ok (btw. you find >>it in the etc dir of Chiba dist). >> >>but besides that Chiba won't handle this correctly yet. - we're not >>processing the children of label, hint,help, alert at the moment for >>further child elements. :( >> >> >>>maybe there's even a way more convenient way to acchieve what i'm trying >>>here. >> >>the only way i currently can think of is to use a setvalue to set the >>value of the alert before the revalidate occurs but i don't know if >>that's possible with your form. >> >>sorry i've no better news and hope Chiba will some day support this >>usecase. >> >>Joern >> >> >> >> >>>so i would greatly apprecciate any help with that. >>> >>>thanx in advance, >>>anja >>> >>> >>>----------------------------------------------------------------- >>><?xml version="1.0" encoding="ISO-8859-1"?> >>><html xmlns="http://www.w3.org/2002/06/xhtml2" >>> chiba:stylesheet="html4.xsl" >>> xmlns:chiba="http://chiba.sourceforge.net/2003/08/xforms" >>> xmlns:xforms="http://www.w3.org/2002/xforms" >>> xmlns:xlink="http://www.w3.org/1999/xlink" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >>> xmlns:ev="http://www.w3.org/2001/xml-events" >>> xml:base="http://localhost/chiba-0.9.5/"> >>> <head> >>> <xforms:model id="model01"> >>> <xforms:instance id="instance01" xmlns=""> >>> <data> >>> <email/> >>> <alert> >>> <emailEmpty>please insert name</emailEmpty> >>> <emailInvalid>please insert valid email-address</emailInvalid> >>> </alert> >>> </data> >>> </xforms:instance> >>> >>> <xforms:submission id="validate" action="jsp/debug-instance.jsp" >>>xforms:method="post" xforms:replace="none"/> >>> >>> <xforms:bind id="bEmail" nodeset="instance('instance01')/email" >>>required="true()" constraint="string-length(.) > 2 and contains(., '@') > > and > >>>not(starts-with(., '@')) and not(substring(., string-length(.)) = > > '@')"/> > >>> <xforms:bind id="bAlertEmpty" >>>nodeset="instance('instance01')/alert/emailEmpty" >>>relevant="string-length(instance('instance01')/email)=0"/> >>> <xforms:bind id="bAlertInvalid" >>>nodeset="instance('instance01')/alert/emailInvalid" >>>relevant="string-length(instance('instance01')/email) > 0"/> >>> </xforms:model> >>> </head> >>> <body> >>> <xforms:group xforms:appearance="full"> >>> <xforms:label>Alert-Test</xforms:label> >>> <xforms:input xforms:bind="bEmail"> >>> <xforms:label>Email:</xforms:label> >>> <xforms:alert><xforms:output > > xforms:bind="bAlertInvalid"/><xforms:output > >>>xforms:bind="bAlertEmpty"/></xforms:alert> >>> </xforms:input> >>> <xforms:trigger> >>> <xforms:label>submit</xforms:label> >>> <xforms:action> >>> <xforms:send submission="validate"/> >>> </xforms:action> >>> </xforms:trigger> >>> </xforms:group> >>> </body> >>></html> >> >> >>> >>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by: IBM Linux Tutorials >>>Free Linux tutorial presented by Daniel Robbins, President and CEO of >>>GenToo technologies. Learn everything from fundamentals to system >>>administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >>>_______________________________________________ >>>Chiba-users mailing list >>>Chi...@li... >>>https://lists.sourceforge.net/lists/listinfo/chiba-users >>> >> >> >> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Chiba-users mailing list > Chi...@li... > https://lists.sourceforge.net/lists/listinfo/chiba-users > |