[OFBiz] Users - Convert region to ftl

Ashish Hareet Ashish.Hareet at cpbinc.com
Mon Mar 14 16:59:01 EST 2005


Thanks for the response Chris.

While trying to implement your suggestion, I came across this in the wiki that gives me the impression that forms widgets are to be used for places where we look up entities from the database. Although it doesn't mention, the question is whether I can make any arbitary form & add data to the database via this form. 

Second, to implement your suggestion, here's my understanding of how to do it.

The first part of your post was done anyways. So I move onto the screen definition where I change the relevant screen to point to "CustomerForms.xml". Then I went & made the requisite file in the desired path. My problem is to do with the understanding of this xml file which I belive is called as the "form-widget"

Here's my definition along with notes on my understanding of it, so far with errorneous result

--------------------------------------------------CustomerForms.xml ------------------------------------------
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd">
	<form name="CreateNewCustomer" <!-- This is the name as referenced by the screen widget -->
		type="single" <!-- single, list or multi -->
		target="createCustomer" <!-- The simple method to call, I'm not sure where the "MySimpleMethods.xml" should be placed, can I provide some URI for it, if so how & where-->
		title="" 
		default-map-name="parameters" <!-- This is the resulting map that the method expects -->
		default-title-style="tableheadtext" <!-- Should I be concerened -->
		default-widget-style="inputBox" <!-- for fields with no widget-style defined, this will be used -->
		default-tooltip-style="tabletext"> <!-- Should I be concerened -->

		<field name="USER_TITLE" title="User Title"/> <!-- I just tried one field for starters & if I remove this, there are no errors generated. AFAIK this is my problem statement -->
	</form>
</forms>
--------------------------------------------------End CustomerForms.xml ------------------------------------------

The error -      [java] 7824398[        ModelScreen.java:103:ERROR]

which I'm sure has to do with my form-widget xml definiton

Please excuse my ignorance if any, I'm still a novice & the entire framework is just too overwhelming for me right now

Thanks
Ashish Hareet




-----------------------Original Message-----------------
To convert that form, it would perhaps be better to use the form widget instead of freemarker.

In " <component://party/webapp/partymgr/WEB-INF/controller.xml%22>
you should change the view map from:

    <view-map name="newcustomer" type="region"/>
to
    <view-map name="newcustomer" type="screen" page=" component://party/widget/partymgr/CommonScreens.xml#newcustomer"/ <component://party/widget/partymgr/CommonScreens.xml#newcustomer%22/>>

then in party/widget/partymgr/CommonScreens.xml add the screen "newcustomer"  should look something like this.
..................................
    </screen>
	    <screen name="createnewcustomer">
        <section>
            <widgets>
                <decorator-screen name="main-decorator">
                    <decorator-section name="body">
                          <container>
				<include-form name="CreateNewCustomer" location=" component://party/webapp/partymgr/WEB-INF/customer/CustomerForms.xml"/ <component://party/webapp/partymgr/WEB-INF/customer/CustomerForms.xml%22/>>
                          </container>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
.....................................
Then create a customer directory under party/webapp/partymgr/
and then create a file "CustomerForms.xml" which should look something like this:
.....................................
<forms xmlns:xsi=" <http://www.w3.org/2001/XMLSchema-instance%22> 
        xsi:noNamespaceSchemaLocation=" <http://www.ofbiz.org/dtds/widget-form.xsd%22>>
    <form name="CreateNewCustomer" type="single" 
            target="createnewcustomer" title="" default-map-name="prodCatalog"
            default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">


enter all your fields  ( I don't believe auto-field service is necessary, could someone back me up?)

    </form>
</forms
...............................
Because this is sending all of the variables to a simple-method you should just need to have fields with names that
correspond to the names in the simple-method.  Although if you wanted to go all out you could also convert the simple method
to a service and use nested forms (i haven't used nested forms yet, so i'm not sure how they work in detail).

I hope I spelled this out clear, if I haven't, I'd be happy to clarify.

,Chris


-------  Original



More information about the Users mailing list