[support] Views help: trying to circumvent an argument when there are no available values

Steven Scotten steves at splicer.com
Mon Nov 9 02:39:37 UTC 2009


Hi folks—

This one has had me stumped for months, and it seems like the sort of  
thing that should be easy, but I'm obviously missing something basic.

I'm using Location Views, which provides a view called  
"location_directory" and permits users to view nodes by location,  
selecting first country, then state/province, then city and seeing a  
list of all nodes that match that city. It's a pretty straightforward  
view:

Arguments: Location: Country, Location: Province, Location: City. Each  
uses style: list
Filters: Node: Published or admin, Location: LID not empty

Each of the arguments looks like this:

Action to take if argument is not present:

Summary, sorted ascending
wildcard: all
Validator: <Basic validation>
Action to take if argument does not validate: Display all values.

This works wonderfully except for countries which have no provinces  
listed at all. Singapore is one such. In this case, the Singapore  
listing lists "unknown" as the only province selection. Clicking on  
"unknown" does not take us to /location/directory/sg/all but instead  
to /location/directory/sg/ ... in other words, it links to the same  
page.

I'm trying to figure a way to circumvent the province (the second  
argument) in cases where the selected first argument means there are  
no values to provide for a second argument.

I thought I'd gotten somewhere with the following approach:

* Configure Argument Location: Province
* Change "Action to take if argument is not present" to "Provide  
default argument"
* Set "Default argument type" to "fixed entry"
* Set "Default argument" to "all" (or whatever is set as "Wildcard"  
above)

But to my chagrin that simply always circumvented the province and  
went right to the listing of cities.

Is the only solution I have to use PHP Code as a validator and display  
a summary if the validator fails? Would such an approach even work?

My thanks,


Steve


More information about the support mailing list