You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by vivek <er...@gmail.com> on 2010/10/09 15:28:57 UTC

How do i store the return value from javascript in XML from declaration

Hi All,

Here i am trying to add drop down attribute to the defaultConfigOptionId tab
inside product administration page. When we are adding not updating the
config item to the product i wish that the configItemId should be passed as
an entity constraint to the drop down of defaultConfigOptionId. Here below
is the code i am trying: form name: AddProductConfig File: ProductForms.xml

<field name="configItemId" title="${uiLabelMap.ProductConfigItem}"
event="onchange" action="return configItemIdPassed()">
  <drop-down>
      <entity-options entity-name="ProductConfigItem"
description="${configItemName} 
          <entity-order-by field-name="configItemName"/>
      </entity-options>
  </drop-down>
</field>

<field name="defaultConfigOptionId"
title="${uiLabelMap.DefaultConfigOptionId}">
    <drop-down>
    <entity-options entity-name="ProductConfigOption"
key-field-name="configOptionId" description="${configOptionId}">
      <entity-constraint name="configItemId" operator="equals"
value="wantJavaScriptValueHere"/>
      <entity-order-by field-name="configItemId"/>
    </entity-options>
    </drop-down>
</field>

js included in other ftl 
function configItemIdPassed(){
var idPassed = document.AddProductConfig.configItemId.value;
return idPassed;
}

However i added the dropdown to updateProductConfig form successfully as
confgiItemId is already available.

I am stuck at this place & is desperately looking out for option to do it.
Your help would be highly appreciated.

thanks

-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/How-do-i-store-the-return-value-from-javascript-in-XML-from-declaration-tp2969572p2969572.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: How do i store the return value from javascript in XML from declaration

Posted by vivek <er...@gmail.com>.
Thanks Bilgin,

But i found out that with help of submitting the form partially, the
parameters can be populated & the javascript can be used.

The concern is resolved & working without heck now

Thanks again

-----
Kind Regards,
Vivek J
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/How-do-i-store-the-return-value-from-javascript-in-XML-from-declaration-tp2969572p3095154.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: How do i store the return value from javascript in XML from declaration

Posted by Bilgin Ibryam <bi...@gmail.com>.
Hi Vivek,

you can't pass a value from javascript which is executed at run time (when
the user clicks on the dropdown) to the entity-constrain which is executed
at render time (when the page is initially generated by widget engine). You
can achieve what you want, by removing entity-constrain and change your
javascript code to set defaultConfigOptionId option using configItemId value

HTH
Bilgin

On Sat, Oct 9, 2010 at 2:28 PM, vivek <er...@gmail.com> wrote:

>
> Hi All,
>
> Here i am trying to add drop down attribute to the defaultConfigOptionId
> tab
> inside product administration page. When we are adding not updating the
> config item to the product i wish that the configItemId should be passed as
> an entity constraint to the drop down of defaultConfigOptionId. Here below
> is the code i am trying: form name: AddProductConfig File: ProductForms.xml
>
> <field name="configItemId" title="${uiLabelMap.ProductConfigItem}"
> event="onchange" action="return configItemIdPassed()">
>  <drop-down>
>      <entity-options entity-name="ProductConfigItem"
> description="${configItemName}
>          <entity-order-by field-name="configItemName"/>
>      </entity-options>
>  </drop-down>
> </field>
>
> <field name="defaultConfigOptionId"
> title="${uiLabelMap.DefaultConfigOptionId}">
>    <drop-down>
>    <entity-options entity-name="ProductConfigOption"
> key-field-name="configOptionId" description="${configOptionId}">
>      <entity-constraint name="configItemId" operator="equals"
> value="wantJavaScriptValueHere"/>
>      <entity-order-by field-name="configItemId"/>
>    </entity-options>
>    </drop-down>
> </field>
>
> js included in other ftl
> function configItemIdPassed(){
> var idPassed = document.AddProductConfig.configItemId.value;
> return idPassed;
> }
>
> However i added the dropdown to updateProductConfig form successfully as
> confgiItemId is already available.
>
> I am stuck at this place & is desperately looking out for option to do it.
> Your help would be highly appreciated.
>
> thanks
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/How-do-i-store-the-return-value-from-javascript-in-XML-from-declaration-tp2969572p2969572.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>