Jump to content

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

Recommended Posts

Posted

(Preface)

Since I've been using cdml, I've always search with a text field. Now I'm being asked to provide a new type of search that I haven't figured out how to do. It seems very logical in application, but to produce is another for me.

(Help)

I need to have a pop-up that has (options)

Posted

Hi Paul,

Just to make sure I've got this right!

You would like a pop-up menu which displays 5 field names, then a text field.

You would then like to select one of the fields and the text that is entered into the text field is searched for in the field you specified in the pop-up menu?

Ed.

Posted

OK, if this IS what you want to do then my code following should do it, if it's not then hey someone may be able to use it...

<HTML>

<HEAD>

<script language="javascript">

var fieldArr = new Array();

fieldArr["Field1"] = "Field1";

fieldArr["Field2"] = "Field2";

function field_on_change(selectObj)

{

document.forms["MySearchForm"].temp.name

= fieldArr[selectObj.options[selectObj.selectedIndex].text];

}

</script>

</HEAD>

<BODY>

<P><FORM ACTION="FMPro" NAME="MySearchForm" METHOD="post">

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

<INPUT TYPE="hidden" NAME="-Lay" VALUE="LayoutName"> <INPUT TYPE="hidden" NAME="-format" VALUE="search_results.htm">

<INPUT TYPE="hidden" NAME="-error" VALUE="search_error.htm">

<INPUT TYPE="hidden" NAME="-SortField" VALUE="Name">

<INPUT TYPE="hidden" NAME="-SortORder" VALUE="Ascending">

<INPUT TYPE="hidden" NAME="-max" VALUE="20">

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

<FONT SIZE="+3" FACE="Lucida Handwriting">S</FONT><FONT SIZE="+2" FACE="Lucida Handwriting">EARCH</FONT>&nbsp;

<TABLE BORDER=1 WIDTH=400>

<TR>

<TD WIDTH=300>

<P><FONT SIZE="-1" FACE="Arial">Enter search criteria:</FONT></P>

</TD>

<TD WIDTH=260 BGCOLOR="#FFFFFF">

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

<select name="field" onchange="field_on_change(this)" >

<option>--Select--</options>

<option value>Field1</options>

<option value>Field2</options>

</select>

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

</TD>

</TR>

<TR>

<TD COLSPAN=2 WIDTH=560 BGCOLOR="#000066">

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

</TD>

</TR>

</TABLE>

</FONT></CENTER>

</FORM></P>

</BODY>

</HTML>

Hope this helps at least one person as I took me ages to work out how to do it!

Ed

Posted

You could use CDML like this:

	<select name="-SortField">

			<option value="">-None- [FMP-LayoutFields]

			<option>[FMP-FieldName: Raw] [/FMP-LayoutFields]

		</select>



		<!-- After processing, the HTML sent to the browser could look like:

			<select name="-SortField">

				<option value="">-None-

				<option>First Name

				<option>Last Name

				<option>Employee Number

			</select>

		 -->

This is from the "CDML Reference" database.

All the best.

Garry

Posted

Hi Paul,

Glad this worked- I hadn't tested it!

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

You don't really need this in this example, (I just used one of my templates to start the script) all this does is set the operator to AND when you have more than 1 field so for example Name = "blah blah blah" AND Age = "blah blah blah"

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

You could do with putting this back into the code. It sets the find operator to equals (as opposed to starting with, ends with etc)

Not sure what you mean by:

"how do I make it so the "iBeam" starts of in the text field"

Explain what you mean by this and I will try to help.

Ed

Posted

Hi Paul

Think I realise now what you meant, you want the cursor to start in the text field when the page loads?

OK, just before the </Form> Tag (towards the end of the script) enter this:

<SCRIPT> document.MySearchForm.temp.focus() </SCRIPT>

Important: If you changed the form name or the name of the text field in the script I gave you then you will need to adjust the line I've given you to reflect this...

MySearchForm is the name of the form

temp is the name of the text field

Hope this is what you needed!

Ed.

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