Jump to content

How To Search On Two Predefined Criteria?


Recommended Posts

Hello Bangalore,

 

As I understand, you want to search by two criteria and see results that match any criteria (like OR logic)?

 

It is rather easy, if your fields have Yes/No type.

 

1) Add one more field with Yes/No type to your table (for example, name it "both").
2) This field is checked if either First field or Second field is checked.
3) Add this field to your Search page as the last field and set the Any item as a default choice.
4) Hide the added field using HTML blocks.
5) Add Header and Footer element to your Search page.
6) To the Footer, add the JavaScript code like:
<SCRIPT LANGUAGE="JavaScript">
function two_choices()
{
var choice1 = document.getElementById("ValueN_10").checked;
var choice2 = document.getElementById("ValueM_10").checked;

if((choice1)&&(choice2))
{
document.getElementById("ValueN_10").checked = false; 
document.getElementById("ValueN_12").checked = true;

document.getElementById("ValueM_10").checked = false; 
document.getElementById("ValueM_12").checked = true; 

document.getElementById("ValueZ_12").checked=false;
document.getElementById("ValueZ_10").checked=true;
}
}
document.getElementById("caspioform").onsubmit=two_choices;
</SCRIPT>

where

N - is the Professional Transporters form element order, which starts at 1 and increments based on the order of the element in the form;
M - is the Professional Transporters form element order;
and Z - is the added field form element order.
 
For example, if you have only two fields and added the hidden third field, N will be 1, M will be 2 and Z will be 4 (because HTML block will be the third field).
 
I hope, it helps.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...