|
Author: jleroux
Date: Tue Aug 24 12:32:52 2010 New Revision: 988508 URL: http://svn.apache.org/viewvc?rev=988508&view=rev Log: A solution for "State field is missing - Not in List or N/A" reported by Sam Hamilton at https://issues.apache.org/jira/browse/OFBIZ-3247 - OFBIZ-3247 I finally decided to use the new Dependent Dropdowns mechanim. I have also refined how it's used in Example to avoid confusion, so changed setDependentDropdownValuesJs.ftl to pass paramKey when it's different from mainId Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyForms.xml ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml ofbiz/trunk/framework/common/webcommon/includes/setDependentDropdownValuesJs.ftl ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyForms.xml?rev=988508&r1=988507&r2=988508&view=diff ============================================================================== --- ofbiz/trunk/applications/party/widget/partymgr/PartyForms.xml (original) +++ ofbiz/trunk/applications/party/widget/partymgr/PartyForms.xml Tue Aug 24 12:32:52 2010 @@ -419,17 +419,10 @@ under the License. <field name="USER_ADDRESS1" title="${uiLabelMap.CommonAddress1}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><text size="30" maxlength="60"/></field> <field name="USER_ADDRESS2" title="${uiLabelMap.CommonAddress2}"><text size="30" maxlength="60"/></field> <field name="USER_CITY" title="${uiLabelMap.CommonCity}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><text size="30" maxlength="60"/></field> - <field name="USER_STATE" title="${uiLabelMap.CommonState}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"> - <drop-down allow-empty="true"> - <entity-options entity-name="Geo" key-field-name="geoId" description="${geoId} - ${geoName}"> - <entity-constraint name="geoTypeId" operator="in" value="STATE,PROVINCE"/> - <entity-order-by field-name="geoId"/> - </entity-options> - </drop-down> - </field> + <field name="USER_STATE" title="${uiLabelMap.CommonState}" widget-style="required"><drop-down allow-empty="false"/></field> <field name="USER_POSTAL_CODE" title="${uiLabelMap.CommonZipPostalCode}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><text size="10" maxlength="30"/></field> <field name="USER_COUNTRY" title="${uiLabelMap.CommonCountry}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"> - <drop-down allow-empty="false" no-current-selected-key="${defaultCountryGeoId}"> + <drop-down no-current-selected-key="${defaultCountryGeoId}"> <entity-options entity-name="Geo" key-field-name="geoId" description="${geoId}: ${geoName}"> <entity-constraint name="geoTypeId" value="COUNTRY"/> <entity-order-by field-name="geoId"/> Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml?rev=988508&r1=988507&r2=988508&view=diff ============================================================================== --- ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml (original) +++ ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml Tue Aug 24 12:32:52 2010 @@ -674,7 +674,20 @@ under the License. <condition> <if-has-permission permission="PARTYMGR" action="_CREATE"/> </condition> + <actions> + <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization but there are still issues. For instance: what if we have 2 couple of dependent dropdowns in the same form? --> + <set field="dependentForm" value="NewUser"/> + <set field="paramKey" value="countryGeoId"/> + <set field="mainId" value="USER_COUNTRY"/> + <set field="dependentId" value="USER_STATE"/> + <set field="requestName" value="getAssociatedStateList"/> + <set field="responseName" value="stateList"/> + <set field="dependentKeyName" value="geoId"/> + <set field="descName" value="geoName"/> + <set field="selectedDependentOption" value="_none_"/> + </actions> <widgets> + <platform-specific><html><html-template location="component://common/webcommon/includes/setDependentDropdownValuesJs.ftl"/></html></platform-specific> <screenlet title="${uiLabelMap.PartyCreateNewCustomer}"> <include-form name="NewUser" location="component://party/widget/partymgr/PartyForms.xml"/> </screenlet> @@ -706,7 +719,20 @@ under the License. <condition> <if-has-permission permission="PARTYMGR" action="_CREATE"/> </condition> + <actions> + <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization but there are still issues. For instance: what if we have 2 couple of dependent dropdowns in the same form? --> + <set field="dependentForm" value="NewUser"/> + <set field="paramKey" value="countryGeoId"/> + <set field="mainId" value="USER_COUNTRY"/> + <set field="dependentId" value="USER_STATE"/> + <set field="requestName" value="getAssociatedStateList"/> + <set field="responseName" value="stateList"/> + <set field="dependentKeyName" value="geoId"/> + <set field="descName" value="geoName"/> + <set field="selectedDependentOption" value="_none_"/> + </actions> <widgets> + <platform-specific><html><html-template location="component://common/webcommon/includes/setDependentDropdownValuesJs.ftl"/></html></platform-specific> <screenlet title="${uiLabelMap.PartyCreateNewProspect}"> <include-form name="NewUser" location="component://party/widget/partymgr/PartyForms.xml"/> </screenlet> @@ -738,7 +764,20 @@ under the License. <condition> <if-has-permission permission="PARTYMGR" action="_CREATE"/> </condition> + <actions> + <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization but there are still issues. For instance: what if we have 2 couple of dependent dropdowns in the same form? --> + <set field="dependentForm" value="NewUser"/> + <set field="paramKey" value="countryGeoId"/> + <set field="mainId" value="USER_COUNTRY"/> + <set field="dependentId" value="USER_STATE"/> + <set field="requestName" value="getAssociatedStateList"/> + <set field="responseName" value="stateList"/> + <set field="dependentKeyName" value="geoId"/> + <set field="descName" value="geoName"/> + <set field="selectedDependentOption" value="_none_"/> + </actions> <widgets> + <platform-specific><html><html-template location="component://common/webcommon/includes/setDependentDropdownValuesJs.ftl"/></html></platform-specific> <screenlet title="${uiLabelMap.PartyCreateNewEmployee}"> <include-form name="NewUser" location="component://party/widget/partymgr/PartyForms.xml"/> </screenlet> Modified: ofbiz/trunk/framework/common/webcommon/includes/setDependentDropdownValuesJs.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/setDependentDropdownValuesJs.ftl?rev=988508&r1=988507&r2=988508&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/setDependentDropdownValuesJs.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/setDependentDropdownValuesJs.ftl Tue Aug 24 12:32:52 2010 @@ -22,7 +22,7 @@ Event.observe(window, 'load', function() Event.observe($('${dependentForm}_${mainId}'), 'change', function() { getDependentDropdownValues('${requestName}', '${mainId}', '${dependentForm}_${mainId}', '${dependentForm}_${dependentId}', '${responseName}', '${dependentId}', '${descName}', '', ''); }); - getDependentDropdownValues('${requestName}', '${mainId}', '${dependentForm}_${mainId}', '${dependentForm}_${dependentId}', '${responseName}', '${dependentId}', '${descName}', '${selectedDependentOption}', ''); + getDependentDropdownValues('${requestName}', '${paramKey}', '${dependentForm}_${mainId}', '${dependentForm}_${dependentId}', '${responseName}', '${dependentId}', '${descName}', '${selectedDependentOption}', ''); } }) </script> \ No newline at end of file Modified: ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml?rev=988508&r1=988507&r2=988508&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/FormWidgetExampleScreens.xml Tue Aug 24 12:32:52 2010 @@ -56,7 +56,8 @@ under the License. <!-- setCountryStatesEventJs.ftl, it's not used here but is a good example of a reusable template-script with harcoded values which make sense --> <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization but there are still issues. For instance: what if we have 2 couple of dependent dropdowns in the same form? --> <set field="dependentForm" value="DropDownFieldsExampleForm"/> - <set field="mainId" value="countryGeoId"/><!-- here mainId and its key are same --> + <set field="paramKey" value="countryGeoId"/> + <set field="mainId" value="countryGeoId"/> <set field="dependentId" value="stateProvinceGeoId"/> <set field="requestName" value="getAssociatedStateList"/> <set field="responseName" value="stateList"/> |
| Free forum by Nabble | Edit this page |
