Jump to content

This topic is 7360 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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 smile.gif 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] 

Posted

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

Posted

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 smile.gif

I didn't think this 'little' popup would slow me down for 2 days - sigh -

Thanks

JP

Posted

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 frown.gif

Posted

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 frown.gif

Good Luck.

Garry

Posted

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!! smile.gifsmile.gif ) working, it's just not poppin' up yet.

How do i get it to popup? I've tried some myself but failed frown.gif

Thanks

JP

Posted

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

Posted

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

Posted

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

Posted

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

  • 3 weeks later...
Posted

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

This topic is 7360 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.