Jump to content

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

Recommended Posts

Posted

I'm trying to perform a search via a CDML web page on 2 fields of a database (field_1 and field_2)

I want the search to require that both fields get entered exactly.

The web security is set so that each needs to be an 'ExactSearch'.

The HTML reads


 <P><INPUT TYPE="hidden" NAME="-op" VALUE=eq>

<INPUT TYPE=text NAME=field_1 VALUE="" SIZE=30>

<INPUT TYPE="hidden" NAME="-LOP" VALUE=AND>

<INPUT TYPE=text NAME=field_2 VALUE="" SIZE=30>

<INPUT TYPE="submit" NAME="-Find" VALUE="Search"></P>

  

If I only limit field_1 to ExactSearch in the web security, I can type field_1 exactly and press Search and it finds the record. However, as soon as I restrict field_2 to ExactSearch, the web browser returns the error:-

"Access Restriction: You do not have access privileges to perform the action :find"

Any ideas where I'm going wrong ?

Thanks.

Gary

Posted

Ok, I'm answering my own questions now.

I've not solved the above problem, but I've partly got around it by creating a calculation field called "mix" (which concatenates field_1 & field_2 within filemaker).

I've then added a small javascript function (concat) to my search webpage that looks like this (imagine the form is called 'formname' )

 

<SCRIPT TYPE="text/javascript"><!--

	

	function conc (){

	document.formname.mix.value = document.formname.field_1.value + document.formname.field_2.value; 

	alert ("checking "+document.formname.mix.value);

	}

	

	//--></script>





 

I've removed the security on field_1 and field_2 and now just set 'mix' to ExactSearch

It seems to work when I enter 2 correct values, and when I enter a wildcard character, it tells me I can't do this ! Excellent !!!

But if I enter a value that is not in the database, I get the message

'The format file "welcome.htm" could not be found'

I'm puzzled now !

welcome.htm is the result web page, which does exist in the web folder and actually works when correct values are selected, but why is filemaker trying to present this as my error page, when my error page has been defined as 'error.htm' ?

Thanks for any help.

Posted

Is the "error" page being called with "-error" or "-err". This is one that got me some time ago!

A "workaround" maybe to add an [FMP-If] tag at the head of the "welcome.htm" page to capture any errors.

Good Luck.

Garry

Posted

I'm actually using -Error (with a capital 'E'), which is a bit strange because all the others seem to be lowercase). I've added it with Claris Homepage because it has all the CDML tags as drag and drop. (so it must be right ?)

I will try -err just in case.

I've actually got over it because it seems the error only occurs when no records are found. so I've added a script that gets performed after a search (using -Script.Presort), that checks if the status(currentfoundcount)=0, if it is then it performs a search for 1 record I've added called "blank".

I've then added an 'if' to my welcome page (as you suggest), but I haven't quite figured that out yet.

Anyway thanks for your help, and have a good Christmas / New Year. wink.gif

Posted

Re: "I'm trying to perform a search via a CDML web page on 2 fields of a database (field_1 and field_2)

I want the search to require that both fields get entered exactly."

First, you do not want to do an "exact match", rather you need to perform the "field contents match" which is different. See the Sample Files forum for CDML -Op values and Symbols demo which discusses the use of the FMPro search symbols.

Using the information from that demo you will find that your code might look like:

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

<input type="text" name="field_1" value="" size="25">

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

<input type="text" name="field_2" value="" size="25">

Second, the -lop is unnecessary as you are using it since "and" is the default. More on this in Sample Files forum at CDML -LOP values. Also in the CDMLRdb.

But what do I know,

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