November 12, 200421 yr Hi For a website I'm working on I stumbled upon something that I can't get working... On a page you have to select a country (this is a fixed list in HTML), hit 'search' and get a result page. Thats working nicely, but what I can get to work properly is this; On the resultpage theres another popup containing the cities and towns of the country selected before, and the values are dynamic. It should use a field (in the same DB) named 'City' to create the list from. So in a way its building its own list on availability. Hope this makes sense to you, 'cause I cant get it to work somehow. I've tried a bunch of things, but all I seem to be able to generate is A) a corrupt list, weird formatting C) Nothing. [edited] -> Ok, I did get a result now using the below code, however, using the inlineaction to populate my popup valuelist results in duplicates. So my new, but related question is: How do I set it so it will only show one 'city' and omit all duplicates? TIA oh yes, the code so far: </span><SELECT NAME='plaats' SIZE=1 > <OPTION Value=""> - No Selection - [FMP-InlineAction: -db=travelcheck.fp5, -lay=cgi, land={fmp-field:land}, -find][FMP-Record] <option Value="[FMP-Field:plaats]">[FMP-Field:plaats] [/FMP-Record][/FMP-InlineAction]
November 13, 200421 yr Try this Javascript: <OPTION Value=""> - No Selection - [FMP-InlineAction: -db=travelcheck.fp5, -lay=cgi, land={fmp-field:land}, -find] <script>var curr_plaats = ""; [FMP-Record] if (curr_plaats != "[FMP-Field:plaats]") { curr_plaats = "[FMP-Field:plaats]"; document.write("<option value='" + curr_plaats + "'>" + curr_plaats + "</option>"); } ; [/FMP-Record] </script> [/FMP-InlineAction] Good Luck. Garry
November 13, 200421 yr Author Thanks Garry, but it is not working, The result I get from your code is not a popup and it does not strip out duplicates. I might be using it the wrong way, but as a result on the webpage I get: - No Selection - AmsterdamRotterdamAmsterdam, just a single line, with duplicates. I thought that maybe not sorting it in the inline might have something to do with it, but adding the sortfield to it results in no data at all. I'm using a single DB for this, page one (startpage) is using a popuplist with fixed Countries, and all I want is a popuplist on the resultpage with all the cities available in the selected country.... that shouldn't be this hard.... right? Can I use a self-relation and javascript somehow? I've tried it myself but my JS skills suck heh I didn't think this 'little' popup would slow me down for 2 days - sigh - Thanks JP
November 13, 200421 yr Author Garry, I've your code as you pasted it again, and the result in the webpage is this: <OPTION Value=""> <script>var curr_plaats = ""; if (curr_plaats != "plaatsa") { curr_plaats = "plaatsa"; document.write("<option value='" + curr_plaats + "'>" + curr_plaats + "</option>"); } ; if (curr_plaats != "plaatsb") { curr_plaats = "plaatsb"; document.write("<option value='" + curr_plaats + "'>" + curr_plaats + "</option>"); } ; if (curr_plaats != "plaatsc") { curr_plaats = "plaatsc"; document.write("<option value='" + curr_plaats + "'>" + curr_plaats + "</option>"); } ; if (curr_plaats != "plaatsa") { curr_plaats = "plaatsa"; document.write("<option value='" + curr_plaats + "'>" + curr_plaats + "</option>"); } ; </script> As you can see it validates incorrect somehow, it pulls out the value of the 'plaats' field and pocesses each record seperatly. The code shows 'plaatsa' twice, which means its not filtering... Any suggestions?? I'm really stuck with this one
November 13, 200421 yr Whoops, I did forget to add the sort: [FMP-InlineAction: -db=travelcheck.fp5, -lay=cgi, land={fmp-field:land}, -sortfield=plaats, -find] I'm not sure why you had no data when you tried the sort. Unfortunately, Related Valuelists do not work through WebCompanion. That is why we have to do things like this Good Luck. Garry
November 13, 200421 yr Author thanks Garry, well it's really weird, when I added the -sortfield before it resulted in nothing usefull. I redid it and now it shows the correct filtering.. BUT, still no popup, just a single line of text on the webpage saying - No Selection - CityACityBCityC So the filtering of duplicates is (finaly!! ) working, it's just not poppin' up yet. How do i get it to popup? I've tried some myself but failed Thanks JP
November 14, 200421 yr Are you including the <select> tags? For example: <select name="plaats"> <OPTION Value=""> - No Selection - [FMP-InlineAction: -db=travelcheck.fp5, -lay=cgi, land={fmp-field:land}, -sortfield=plaats, -find] <script>var curr_plaats = ""; [FMP-Record] if (curr_plaats != "[FMP-Field:plaats]") { curr_plaats = "[FMP-Field:plaats]"; document.write("<option value='" + curr_plaats + "'>" + curr_plaats + "</option>"); } ; [/FMP-Record] </script> [/FMP-InlineAction] </select> All the best. Garry
November 14, 200421 yr The other thing that I have just noticed is that you do not have a closing tag on your OPTION: <OPTION Value=""> - No Selection - While it is not neccessary, it is the complete syntax to use: <OPTION Value=""> - No Selection - </option> Garry
November 14, 200421 yr Author Thanks Garry, I finaly got it to work as I wanted to, and the </option> tag is very neccessary... without the closing tag it wil generate a single line of text, WITH the closingtag (or even removing it all so the list will start with the first city) works like a charm. You have no idea how much time you have saved me, I was setting up a relationalDB just to hold the data needed and script my way into removing duplicates from it... THANKS! JP
November 16, 200421 yr Whether or not the cloption tag is necessary depends entirely on your document's DOCTYPE. For anything earlier than XHTML 1.0 Transitional it is optional (pardon the pun), but all XHTML DOCTYPEs require *all* tags to be closed. Also bear in mind that a well-intentioned but incomplete or malformed DOCTYPE will trigger the parser to slip into quirks mode, which essentially validates against HTML 4.01 Loose. Your best bet (and best practise, as Garry suggests) is to close all tags irrespective of other considerations. Cheers, Kevin Futter
November 16, 200421 yr Oops! Keyboard mishap there. My opening sentence should begin "Whether or not the closing option tag ..." Kevin
November 16, 200421 yr Author yes, thanks, I figured that out also But still, thanks for the advice JP
December 7, 200421 yr Author heh I thought I had it under control by now but something weird is happening now... The script Garry gave me is for filtering out multiple countrynames. While testing it before it worked fine; The DB holding countryinfo has multiple records with the same countryname, but it'll show the name only once in the popup... Nice eh? but the weird thing is, if there are more than 10 different countrynames, it wont show more than the first ten. So I'm kinda back to square one with this since im halfway done with the website and I just found out the the most used part of it won't work at all... Any advise would be **VERY** appreciated!! TIA JP
December 8, 200421 yr Author Thanks garry! I did figure it out by putting -max=100 in it, but your suggestion is even more safer than that! Thanks, You're the man! JP
Create an account or sign in to comment