Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Search from pop-up and text field

Featured Replies

(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)

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.

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

  • Author

Thanks Ed. I'll give this a try later on tonight. I just looked at it really quick and it looks exactly like what I

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

  • Author

Ed, that worked perfectly and it was easy enough for me to understand that I added more options. I have a couple of questions:

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

Hi Garry,

Thought there must have been a way, but didn't know how so thanks for that!

Ed.

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.

  • Author

that worked ED.

Thanks

Paul

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.