Jump to content

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

Recommended Posts

Posted

is there are way to set the search criteria of one field to a token at time of submission.

1. I would like to state after the results are displayed that 'xx records have been found for the search for ( token) - I know there it the FMP-CurrentFind, but that list all value hidden and other which is not import for the user to see.

NOTE!! I am sure I could capture the resulting field as it returns in the format file, but in this case the field being requests is keywords, so the result is not a single words.

2. I would like as a token as well so I can send it back to the DB to log the search words.

Posted

From CDML db:

[FMP-FindValueItem]

What it does

[FMP-FindValueItem] is replaced with the value that was part of the find request that created this page.

[FMP-FindValueItem] must be placed between the [FMP-CurrentFind] and [FMP-CurrentFind] tags.

Syntax

[FMP-FindValueItem: Encoding ]

Parameter(s)

First parameter (optional): Encoding. Use one of the following reserved words:

Raw - Don't perform any encoding

URL - Perform URL encoding

HTML - (default) Perform HTML encoding

Syntax example(s)

Return the current find criteria using an HTML file

Current find request is:<br>

[FMP-CurrentFind]

Field: [FMP-FindFieldItem], Op: [FMP-FindOpItem], Value: [FMP-FindValueItem]<br>

[/FMP-CurrentFind]

<!-- After processing it could look like:

Current find request is:

Field: First Name, Op: begins with, Value: Joe

Field: Last Name, Op: equals, Value: Doe

-->

Other tags that are required

[FMP-CurrentFind], [/FMP-CurrentFind]

See also

[FMP-FindFieldItem], [FMP-FindOpItem]

Posted

You can use some Javascript to do this. For example:

<script>

function addtoken()

{

document.myform.elements["-token"].value = document.myform.myfield.value ;

document.myform.submit();

}

</script>

</head>

<body>

<form name="myform" action="FMPro" method="POST" onsubmit="Javascript:addtoken(); return false;">

<input type="hidden" name="-db" value......

.....

<input type="hidden" name="-token" value="">

Enter Data: <input type="text" name="myfield" value="">

.......

The Javascript function makes the value of the token equal to the value of "myfield". Then it submits the Form.

Hope this helps.

Garry

  • 2 weeks later...
Posted

Here is the code

------------------

<script>

function addtoken()

{

document.eyeSearch.elements["-token"].value = document.eyeSearch.i_keywords ;

document.eyeSearch.submit();

}

</script>

Posted

Perfect thanks.

One last question, does the following script make sense if I want to handle to values?

<script>

function addtoken()

{

document.eyeSearch.elements["-token"].value = document. eyeSearch.i_keywords.value ;

document. eyeSearch.elements["-token.1"].value = document. eyeSearch.i_Artist.value ;

document. eyeSearch.submit();

}

</script>

  • 2 months later...
Posted

The answer above is exactly what I need, but mine isn't working.

Could it be because I'm using an include file? I put the <script> info in the main page, but the OnSubmit info in the include file. Here is my code that is not working:

In the main file:

<link href="style.css" rel="stylesheet" type="text/css">

<script>

function addtoken()

{

document.myform.elements["-token.0"].value = document.myform.month.value ;

document.myform.elements["-token.1"].value = document.myform.year.value ;

document.myform.submit();

}

</script>

</HEAD>

In the include file:

<form name"myform" action="FMPro" method="Post" onsubmit="Javascript:addtoken(); return false;">

<INPUT TYPE="hidden" NAME="-DB" VALUE="calendarmonth.fp5">

etc...

<input type="hidden" name="-token.0" value=""><select name ="Month">

<option value="1">January</option>

<option value="2">February</option>

</select>

<input type="hidden" name="-token.1" value=""><select name ="Year">[FMP-Option: Year, List=Years]</select>

<input type="submit" name="-find" value="View Month">

My knowledge of JS is limited to copying/pasting code like this, so thanks for your help!

Posted

To tell if the "include" is working you can view the "Page Source" in the browser. From this you will be able to see if the FM data, i.e. Years, has been entered and the other html is present.

What do you mean by "not working"? What happens?

Good Luck.

Garry

Posted

The include is working. I can see that the FileMaker elements are being filled in.

By "not working," I mean that when I hit the Submit button, the values for Month and Year are not being set as tokens. I have

Current Token:0: [fmp-CurrentToken:0]

Current Token:1: [fmp-CurrentToken:1]

on the Format page, and they are blank after I press the submit button. So I'm guessing there's something wrong with my code. I am currently avoiding the main/include issue by having all of the js code on the same page, and I still can't pass the tokens from the submit button.

Posted

I changed two things, and now it is working:

1. Case sensitive. I had "Years" in one place, but "years" in another. Now I have "years" for both.

2. Hard-coded the <options> instead of using a FMP value list.

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