Question

I have two select dropdowns,

The options in "waypointname" should be based on the current selection in "regionname,

When I code this not using the PF helpers (raw html), I set the optiosn in waypoints to include the full list of options for all regions, then filter using javascript based on value element.
For example, if region value 2 is selected, all waypoints whos value == 2 gets filtered and shown. This approach is not working with the helpers which I would like to use. Mostly because the Maps which I am providing don't allow duplicate keys.
Is it possible?, or is there another approach, thanks ,

@select(
    insForm("regionname"), 
    options(ComboBoxOpts.regionsMap), 
    'id -> "region_field",
    '_label -> "Region Selection",
    '_showConstraints -> false
)


@select(
    insForm("waypointname"), 
    options(ComboBoxOpts.waypointsMap), 
    'id -> "waypoint_field",
    '_label -> "WayPoint Selection",
    '_showConstraints -> false
)
Était-ce utile?

La solution

Other approach is JavaScript (probably jQuery), in your controller you need to create JSON representation of your waypoints grouped by regions and use it in view as JS variable, so after changing regionname value you can just fetch them from collection and render waypointname select using JavaScript.

It's fast, efficient and popular solution.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top