Jump to content

Value list "also display values from" online


cinolas
 Share

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

Recommended Posts

Greetings,

I want to replicate the behavior of the "also display values from" option of field based value lists online.

Allow me to explain:

I want a menu on my web page that will display both vallues but submit only the first value, like it would behave on the Filemaker interface.

I could not find a CDML way of doing this, it would need to involve javascript. Please proove me wrong laugh.gif

Thanks

Link to comment
Share on other sites

Howdy!

I do not think a field-based value list should be a problem unless it is relational and from another db. I could not find the "also display values from" option in FM5 (maybe I missed it?) but there was something similar about using a value list from another file. If it is relational, then I think you are right because I remember reading posts about problems with relational value lists in CDML, but I cannot remember exactly since I have not used them in FileMaker db or web before.

Sorry, no proof one way or the other... just passing along a vague reference I remember reading a few times. wink.gif

--ST

Link to comment
Share on other sites

  • 2 weeks later...

The problem is not that the value list is on another file. The problem is that the CDML replacement tag for value lists only returns the value for the first field (eg the value from the field specified in "also display values from" does not show).

Steve T. the "also display values from" is in "Define Value List", in the "Specify..." dialog box of the "Use values from field".

So let's say I have a value list from the field ClientID and I specify in "also display values from" to also display the field ClientFullName so that Clients don't have to know their ID by heart. On the FMP interface, the client would look at the list and see their name next to their ID but, after the selection is made, only the ClientID is inserted in the field, not their name.

I am trying to recreate this behavior online. I want the client to see a menu with all the client IDs and names BUT i want the value of the chosen option to be only the ClientID.

Any help is greatly appreciated ! Thanks to all.

Link to comment
Share on other sites

I can't prove you wrong about the Javascript. However here is a method using a Calc field to "join" the two fields with a ":" character. Then create a ValueList of this field.

Then with some Javascript place them on the desired locations, like this:

<select name="stuff">

<script>

[FMP-valuelist: Groups, List=GroupList]

val =  "[FMP-valuelistItem]".split(":") ;

document.write("<option value='" + val[0] + " [FMP-valuelistChecked]>" + val[1] + "</option>") ;

[/FMP-valuelist]

</script>

</select>

Good Luck.

Garry

Link to comment
Share on other sites

As an example you may have a products database. It contains a "prodname" field and a "prodid" field.

The Calculation field "prodnameid" = prodname & ":" & prodid

A ValueList is created for this field called "prodnameidVL".

The page contains:

<select name="prodid">

<script>

[FMP-valuelist: prodnameid, List=prodnameidVL]

val =  "[FMP-valuelistItem]".split(":") ;

document.write("<option value='" + val[1] + " [FMP-valuelistChecked]>" + val[0] + "</option>") ;

[/FMP-valuelist]

</script>

</select>

The Select Drop-down would have the "prodid" as the Value and "prodname" as the display.

All the best.

Garry

Link to comment
Share on other sites

  • 4 weeks later...

Missing quote.

Gary provided an excellent working solution (Thanks Garry) but there is a missing single quote before [FMP-valuelistChecked] so the code should actually be B)

<select name="prodid">

<script>

[FMP-valuelist: prodnameid, List=prodnameidVL]

val = "[FMP-valuelistItem]".split(":") ;

document.write("<option value='" + val[1] + "' [FMP-valuelistChecked]>" + val[0] + "</option>") ;

[/FMP-valuelist]

</script>

</select>

Like this it works flawlessly.

Link to comment
Share on other sites

This topic is 6392 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
 Share

×
×
  • Create New...

Important Information

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