You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by acec acec <to...@yahoo.ca> on 2008/04/18 20:19:33 UTC

reset some of field

In my controller.xml, I have two request-maps, addtest
will show the form, when I submit that form, it will
call createArdenTest.
In my createArdenTest(), I did some validations, when
I return an error with type="request-redirect", it
will keep my input information on that form, it is
nice.

But if I want to reset one field on that form and keep
other fields value, what can I do?

<request-map uri="addtest">
        <response name="success" type="view"
value="addtest"/>
        <response name="error" type="view"
value="error"/>
    </request-map>

<request-map uri="createArdenTest">
        <event type="service"
invoke="createArdenTest"/>
        <response name="success"
type="request-redirect-noparam" value="main"/>
        <response name="error" type="request-redirect"
value="addtest"/>
    </request-map>


public static Map createArdenTest(DispatchContext
dctx, Map context) {
            
            String name = (String)
context.get("name");
            if (StringUtils.isEmpty(name) ||
name.length() > 10) {
                return ServiceUtil.returnError("name
is empty or too long");
            } 


      __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com