Jump to content
  • 0

Hiding section of search form


mdupras

Question

Hello --

I have a search form in which I want to offer two or three basic ways to search and then a long list of other more detailed search options. I'd like to hide the second part of the search form unless the user toggles it on. I know how to hide a single field with JavaScript, but is there an easy way to hide an entire group of several fields?

Thanks!

-- Mike

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hello Mike,

Define a function and make all fields hidden within the Java Script function, call this function on page load so every time page loads in browser the function hides all the fields. Then write another function to display all fields and call this function on click of the Advanced Search button.

Best,

Bahar M.

Link to comment
Share on other sites

  • 0

Thank you. I've done this on input forms but not on search forms. I'm struggling to figure out how to define the fields. Right now, I've created a virtual checkbox and am trying to use it to disable just one field on the search form, for testing, but so far it's not working. Here's my code:

<SCRIPT LANGUAGE="JavaScript">
function hideBar() {
if (document.getElementById("cbParamVirtual1").checked)
{
document.getElementById("EditRecorddine_alcohol").disabled = true,
document.getElementById('caspioform').EditRecorddine_alcohol.value = "";
}
}
onload = hideBar;
document.getElementById("cbParamVirtual1").onclick = hideBar;
</SCRIPT>
My guess is that I'm missing something simple here -- can you help?

Thanks!

-- Mike

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
Answer this question...

×   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...