setting formfield value onLeave()

Whats wrong in this code?

var catvalue=controller.getDataProviderValue(catno)
if (catvalue= “FRP019”)
{
controller.setDataProviderValue(prodname, “Fmoc-L-Isoleucine PEG Resin”)
}

am I missing something?

what am trying to do is if the catalog number is “XXXXX” then the Product value should automatically sets when I change the cursor from the catno field.

any help is appreciated

if (catvalue == “FRP019”)

should work… In javascript equal is ==

bye

automazione:
if (catvalue == “FRP019”)

is not working I tried it.
Thanks

Hello arumalla,

I wonder if enabling the field for input helps?

var catvalue=controller.getDataProviderValue(catno)
if (catvalue== “FRP019”)
{

elements.prodname.enabled = true;

controller.setDataProviderValue(prodname, “Fmoc-L-Isoleucine PEG Resin”)
}

Sven

Note: getDataProviderValue(dataprovidername) returns the value dynamicly based on the name you provide (I can’t imagine a sitution you whould ever need this, but was requested in the past by user)
Normally you just use the dataprovider name directly example:

var calc = order_id + customer_id;

Here order_id and customer_id contain the data from current record column/calc/etc.

You are using getDataProviderValue in a very strange way… this is the same:

var calc = order_id + customer_id;
var calc = getDataProviderValue(‘order_id’) + customer_id;

so normally no need to use getDataProviderValue !

var catvalue=controller.getDataProviderValue(catno)
if (catvalue= “FRP019”)
{
controller.setDataProviderValue(prodname, “Fmoc-L-Isoleucine PEG Resin”)
}

This indeed works if you put catno and prodname between quotes!
controller.getDataProviderValue(‘catno’)
controller.setDataProviderValue(‘prodname’, “Fmoc-L-Isoleucine PEG Resin”)

But as Jan Blok also pointed out, the next code is more obvious:
if (catno == “FRP019”)
{
prodname = “Fmoc-L-Isoleucine PEG Resin”;
}

suggestion:(noscripting needed)
1)create a table PRODUCTS with columns catno and prodname
2)create a relation tableX:catno = tablePRODUCTS:catno.
(where tableX is the table where the above script/form was placed in)
3)make column prodname in tableX a lookup, based on this relation.

Hope this helps.

Thanks Maarten,
It just worked as I wish… Thanks

May be I am thinking too much after being a programmer all these years. but with Servoy we don’t need to think that much. I think I took a little more time to realize this.

Thanks for the Great Product ever known to mankind.

~Chandra