how can i use JS to remove a Combo Box choice ?

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

how can i use JS to remove a Combo Box choice ?

Post by Jaymer »

Lets say I have a text field with static choices: North, South, East

When I enter a BO to create a new record, SOMETIMES I need to eliminate East from the choices.
(based on some testable condition).

How can I remove "East" from the dropdown data source so only North & South are the available choices to the user.
I need some help with the Jquery/JS.

(Note: I have already done a dynamic rule which says "You cannot select East at this time" if this is one of those time - but we need to eliminate East altogether from the list)
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: how can i use JS to remove a Combo Box choice ?

Post by PointsWell »

Jaymer wrote:Lets say I have a text field with static choices: North, South, East

When I enter a BO to create a new record, SOMETIMES I need to eliminate East from the choices.
(based on some testable condition).

How can I remove "East" from the dropdown data source so only North & South are the available choices to the user.
I need some help with the Jquery/JS.

(Note: I have already done a dynamic rule which says "You cannot select East at this time" if this is one of those time - but we need to eliminate East altogether from the list)
I have repeatedly requested the ability to write conditional queries to allow for:

Code: Select all

IF Witch.Type="Good" Then FIND Location WHERE Location.Direction="North" OR Location.Direction="South" ELSE IF Witch.Type="Wicked" Then FIND Location WHERE Location.Direction="East" OR Location.Direction="West"
You could adjust your data model to use external reference data e.g.
BO: Location
Attributes: Direction, Virtue

Then Witch.psLocation filter becomes FIND Location WHERE Location.Virtue=Witch.Type

You cannot achieve straightforward limiting based on the value of another field at the moment, this is a major PITA that requires extra data modelling to get round. the upside is reference data changes are not a development issue.
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: how can i use JS to remove a Combo Box choice ?

Post by Jaymer »

right, but as in my case, north, south, east will always be north, south, east.

i don't want to create ANOTHER reference for something so simple - don't need database access just to pick from a choice list of 3.

There's Kendo example code on how to so exactly this - but I haven't found the key to adapt it to Aware terminology.

Another thing I guess, would be for Aware to allow building a Choice list from a text field "North|South|East" and use an expression to load it. Prolly easier to find the JS - I only need this on 1 screen in my whole app. 1 Form is used for North/South, another Form only for East (and thus it doesn't need the pulldown).
Sure, I could make ANOTHER field just to be used on the form with North/South, and then ANOTHER rule to move that selection to the real field.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply