Jump to content

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

Recommended Posts

Posted

Thanks to inputs from this forum I've been able to successful build a value list from a another database using FMP-InlineAction.

Now I'd like to be able to select a default value in the value list based on the current value for the field in the record being edited. So my question is, in the code below I use the literal value "2" for my FMP-If comparision, but what I really need to do is compare to the value in the field of the current record in my database being edited. I just don't know the syntax to refer to a field in this database once inside a InLineAction tag.

Hope this is clear and any suggestions are of course appreciated.

<SELECT NAME='genus_id' SIZE=1 >

<OPTION VALUE=""> - No Selection -

[FMP-InlineAction: -db=genusDB.fp5, -lay=mylayout, -findall]

[FMP-Record]

<option value="[FMP-Field:genus_id]"

[FMP-If: Field:genus_id .eq. 2]

SELECTED

[FMP-Else]

[/FMP-IF]

>[FMP-Field:description]

[/FMP-Record]

[/FMP-InlineAction]

</SELECT>

Posted

Here is a metod using some Javascript:

<script>var genusid = [FMP-Field: genus_id];</script>

<SELECT NAME='genus_id' SIZE=1 >

<OPTION VALUE=""> - No Selection - </option>

[FMP-InlineAction: -db=genusDB.fp5, -lay=mylayout, -findall]

[FMP-Record]

<script>

if (genusid == [FMP-Field:genus_id]) {

document.write('<option value="[FMP-Field:genus_id]" selected>[FMP-Field:description]</option>');}

else {

document.write('<option value="[FMP-Field:genus_id]">[FMP-Field:description]</option>');}

</script>

[/FMP-Record]

[/FMP-InlineAction]

</SELECT>


Hope this helps.

Garry

Posted

RE: Thanks to inputs from this forum I've been able to successful build a value list from a another database using FMP-InlineAction.

Why not to do it directly in FM database? It will be faster because the WC doesn't have to process another request.

Posted

Garry,

Your example didn't just help, it worked !

It's also nice to now have a java script example I can adapt to other uses. Many thanks as always.

Hunter

Posted

Anatoli,

Also, thanks for your suggestion. The reason I used FMP-InlineAction to create the value list was because the database with the values for the list was related through an id field and I wanted to show the description in my dropdown. I was unable to make this work with a value list defined in Filemaker.

Hunter

Posted

The related value list is standard in FM.

Description is done in HTML code.

InLines are great and with incredible power, but their use is really just if you must process something in other database on the same page as the main db.

Posted

Some aspects of this discussion are beyond my present Filemaker skill level. But in general, I'm interested in learning new ways to solve problems especially if it can be done simpler.

But, in this case I refer you to the earlier thread in the CDML forum:

"Value lists: store ID, but display description ? "

Where what I needed was to "process something in other database on the same page as the main db."

If the InLineAction solution I used was too heavy you are of course welcome to show me a better way to solve this.

Hunter

Posted

Maybe I do not understand your problem. I usually do found easily solution of any problem, which crossed my way. The hardest part is for me understand what is the problem, when I know nothing about other people solution logic.

It is the same like translation from English: driver can be anything from software, through Hi Frequency Speaker, car or railway engine driver. In our language we have usually separate words for each different driver.

Start with FileMaker -- you can have the Value list in other file linked to current file, can you?

Posted

The problem is that the information from a second field, in the value list, is not accessable from the value list. For example:

<select name="myfield">

[FMP-ValueList: item_ids]

<option value="[FMP-ValueListItem]">[FMP-Field: item_description]</option>

[/FMP-ValueList]</select>


Hence, an [FMP-InlineAction] may be the best method.

Hope this makes sense. All the best.

Garry

This topic is 8167 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.