Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Perform a find that looks at two different fields


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

Recommended Posts

Posted

On my web page (CDML) I have a place that I type my criteria for a find, hit the submit button, and the records that match come up.

Right now the field on my web page looks at one field from my database to perform the find. Is it possible to have it look at two fields.

What I am after is if I do a find for "Harry" and hit submit, I want the find criteria to 1) first look at the field and find any records that match "Harry" and 2) only find records that have a seperate checkbox checked yes.

I want the 2nd checkbox criteria to be seamless on my web page and work without the users knowlege. I know how to do it if I had both search criteria visible and the user picked them both and then hit submit, but I am not sure how to make the second one a hidden criteria that is always there. Here is kind of how I have it set up now without the second checkbox criteria.

<font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><span class="text">

<input type="hidden" name="-db" value="@hand.FP5">

<input type="hidden" name="-lay" value="Results">

<input type="hidden" name="-format" value="Summary.htm">

<input type="hidden" name="-error" value="errors.htm">

<input type="hidden" name="-sortfield" value="Project">

<input type="hidden" name="-max" value="All">

<input type="hidden" name="-op" value="eq">

<input class="text" type="text" name="Web" value="" size=8>

<input type="hidden" name="-find" value="Submit">

LR

Posted

USE THIS RESOURCE OFTEN.

http://www.filemaker.com/support/index.html

________________________________________________________

Search and read: Article Number: 104829, and Article Number: 105687

________________________________________________________

A checkbox, per se, may not be necessary. Certainly not as such for the solution. A standard field containing "yes" (or any other consistent databit) or left blank will suffice. Whichever suits your needs, let's now call it "confirm".

<font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><span class="text">

<input type="hidden" name="-db" value="@hand.FP5">

<input type="hidden" name="-lay" value="Results">

<input type="hidden" name="-format" value="Summary.htm">

<input type="hidden" name="-error" value="errors.htm">

<input type="hidden" name="-sortfield" value="Project">

<input type="hidden" name="-max" value="All">

<input type="hidden" name="confirm" value="=">

<input type="hidden" name="-confirm" value="yes">

<input type="hidden" name="Web" value="=">

<input class="text" type="text" name="Web" value="" size=8>

<input type="hidden" name="-find" value="Submit">

Or you can use the "==" on two fields, though you will find any records with both fields blank (which may or may not be a blessing). Or you can use the .eq tag, I just prefer the symbols.

Posted

Just as an aside, when you are performing a -find you would be well advised to use some JavaScript to make sure something has been entered in the field(s) by the client. It's easier on everything to pop up a message "fill all fields" or some such. Otherwise the db must be engaged and the client gets sent to an error page or an undesired record is found.

I forget the link, but I believe a search of "nervous finger" in one of the internet forums might reveal an earlier thread which I initiated and in which someone kindly provided an excellent link to the very code for which I was looking.

Posted

As suggested above (Good Idea) I dropped the check box idea. Now I have one find field in my web page that I want to look at two fields on my database at the same time (the fields are named "Web" and "User"). Here is how I formatted the CDML. But the find only looks at one field, not both???

<input type="hidden" name="-op" value="eq" border="0">

<input type="hidden" name="-db" value="@hand.FP5">

<input type="hidden" name="-lay" value="Results">

<input type="hidden" name="-format" value="Summary.htm">

<input type="hidden" name="-error" value="errors.htm">

<input type="hidden" name="-sortfield" value="Project">

<input type="hidden" name="-max" value="All">

<input type="hidden" name="User" value="">

<input type="hidden" name="Web" value="">

<input class="text" type="text" name="Web" value="" size=8>

<input type="hidden" name="-find" value="Submit">

Posted

You are not assigning a value to "User".

<input type="hidden" name="User" value="">

<input type="hidden" name="Web" value="">

<input class="text" type="text" name="Web" value="" size=8>

Try making it the same as "Web" and remove the 'hidden' "Web".

Good Luck.

Garry

Posted

Garry is right. You either need to hard-code in the user or you need to provide another text field for the client to make that entry.

Now about your line <input type="hidden" name="-op" value="eq"> there are a couple of things. (No I'm not going to go on about using "=" instead of "eq", they both do the same thing.) First, you need one of those lines for EACH field on which you want the operator to act. Secondly, while one can place code willy-nilly wherever one wants in a form action, I like to follow an order within the <form>...</form> such that I can easliy find specific lines should editing be necessary.

db

lay (only if necessary)

format

error (even when seemingly unnecessary)

code relating to the action (hidden and/or text)

code incidental to the action (sort or other modification)

action

or

<input type="hidden" name="-db" value="@hand.FP5">

<input type="hidden" name="-lay" value="Results">

<input type="hidden" name="-format" value="Summary.htm">

<input type="hidden" name="-error" value="errors.htm">

<input type="hidden" name="-op" value="eq">

<input type="text" name="User" value="" size="18">

<input type="hidden" name="-op" value="eq">

<input class="text" type="text" name="Web" value="" size="8">

<input type="hidden" name="-sortfield" value="Project">

<input type="hidden" name="-max" value="All">

<input type="submit" name="-find" value="Submit">

And the code you posted has the value="Submit" as type="hidden".

Posted

Keith,

I dont show the entire code above. The input type is hidden because I actually have created a graphical button that acts as the submit button. But I digress.

The above example produces 2 text fields in which to do a search. The following portion of the code produces the 2 fields:

<input type="text" name="User" value="" size="18">

<input class="text" type="text" name="Web" value="" size="8">

This works great if I want to enter data into either of the fields to perform the find. What I was wondering is if it is possible to have just one input class="text" type="text" field on my web page that can look at both database fields "User" and "Web."

LR

Posted

'Fraid not.

If you want the client-directed search to be on two different data bits (strings?) each unique to one particular field of two fields, you must either hard_code one field or give the client two input fields and require both through a JavaScript control.

Posted

I had done quite a bit of playing with this one without any success before I posted this question here. I had hoped that I had just missed something and that it could somehow be done.

But where there is a will there is a way. It is not the perfect solution I was after, but I was able to create a workaround of sorts.

Since it can't be done in CDML, I created a calc field in FileMaker that contains the contents of the 2 fields in question. I linked my find criteria on my web page to the calc field. So essentially it accomplishes the same thing...one text field on my web page searches 2 fields from my database at the same time.

Thanks for all the help and suggestions.

LR

Posted

Larry,

I now see what you are trying to achieve; a search on two fields with the same value. Hence, only one input.

You can achieve this with a little bit of Javascript.

In the <head> tags:

<script>function copyField () {

document.myform.User.value = document.myform.Web.value ;

document.myform.submit() ;

} </script>


In the <body> tags:
<form name="myform" .....>

.

.

<input type="hidden" name="User" value="">

<input type="text" name="Web" value="">

<input type="hidden" name="-find">

<input type="button" value="FIND" onclick="copyField();">

</form>


Hope this helps.

Garry

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