Expand my Community achievements bar.

Populate drop-down lists based on check box selections

Avatar

Level 2

Hi. I'm creating a Service Work Order form. At the top, there are several check boxes for the various services we provide, under that , more text fields, drop downs and checkboxes to elaborate on those services, and then at the bottom, fields for pricing.

I'd like the top half of the form to drive the pricing info that is available or that auto-populates at the bottom.

Ideally, I'd like to make the pricing specific based on 3 things:

the service checkbox

the client

and the details on that service

For example:

If Client XYZ wants Service A that includes subservice B

$123 should show up on the bottom half in the field for that service

If Client ABC wants Service B that includes subservice C

$456 should show up on the bottom half in the field for that service

Does that make sense?

I've been unable to get code to work in either the calculate and pre-Open options

I first tried calculate and used this code (which was just a guess on my part)

if (CheckBox1 == 1) and if (CheckBox9 == 1) then
$.rawValue = 50
elseif
(CheckBox2 == 1) and if (CheckBox9 == 1) then
$.rawValue = 50
elseif
(CheckBox5 == 1) and if (CheckBox9 == 1) then
$.rawValue = 55
elseif
(CheckBox6 == 1) and if (CheckBox9 == 1) then
$.rawValue = 55
elseif
(CheckBox7 == 1) and if (CheckBox9 == 1) then
$.rawValue = 50
elseif
(CheckBox8 == 1) and if (CheckBox9 == 1) then
$.rawValue = 50
else
$.rawValue = 0
endif

That didn't do anything but give me an error about "and"

So I tried putting code in pre-Open:


// clear the dropdown displayed value and items
this.rawValue = null;
this.clearItems();

// repopulate the items based on the checkboxes
if(offshore.rawValue == 1)
{
    this.addItem("$40.00", "offshore_001");
    this.addItem("$45.00", "offshore_002");
    this.addItem("$50.00", "offshore_003");
}
if(inland.rawValue == 1)
}
    this.addItem("$40.00", "inland_001");
    this.addItem("$45.00", "inland_002");
    this.addItem("$50.00", "inland_003");
}

I got no error but nothing populated and the drop-down was, in effect, disabled.

Any help would be appreciated.

Thanks!

0 Replies