Jump to content

Skip embedded search form on load for report


Recommended Posts

Is there a way to use the 'Allow users to select data using a search form' option on a tabular report but to SKIP opening the search form on 1st load of the report?

Meaning, I'd like the user to go straight to the report's results and THEN if they want to search/filter they can click the 'Search' link and go to the search form. 

I know how to use a separate submission form to do a search/filter but that causes a LOT of extra datapages in the app and I have to pay for those over my limit (my app is huge). 

Also it's far more intuitive to open the full results set and then do a filter. It's clunky to have to go through a search form first to get to the results. This should be a standard option, IMO, like a check box in the wizard for 'don't open search form upon report opening.

That said, I need a workaround. I got some basic concept for it from someone:

"You will need to pass parameters to the URL of the resultspage for eg: showform =0 or 1

In the configure search fields you will write a javascript to hide the form is the showform is 0, When they link to see the search form again then you will pass the parameter to say 1 then the search form JS will show the fields in the search form. " 

I have no idea how to implement this in the report itself. If anyone has any ideas that'd be really great- thanks!

Link to comment
Share on other sites

On 2/14/2017 at 11:13 AM, DesiLogi said:

Is there a way to use the 'Allow users to select data using a search form' option on a tabular report but to SKIP opening the search form on 1st load of the report?

Meaning, I'd like the user to go straight to the report's results and THEN if they want to search/filter they can click the 'Search' link and go to the search form. 

I know how to use a separate submission form to do a search/filter but that causes a LOT of extra datapages in the app and I have to pay for those over my limit (my app is huge). 

Also it's far more intuitive to open the full results set and then do a filter. It's clunky to have to go through a search form first to get to the results. This should be a standard option, IMO, like a check box in the wizard for 'don't open search form upon report opening.

That said, I need a workaround. I got some basic concept for it from someone:

"You will need to pass parameters to the URL of the resultspage for eg: showform =0 or 1

In the configure search fields you will write a javascript to hide the form is the showform is 0, When they link to see the search form again then you will pass the parameter to say 1 then the search form JS will show the fields in the search form. " 

I have no idea how to implement this in the report itself. If anyone has any ideas that'd be really great- thanks!

I have an idea how you may implement that.

- Add a virtual field to the search form, receive default value 1.

- Hide field using html blocks, you may find solution here

- insert the following script into the footer:

<script>
window.onload = function hide(){

}
var x = document.getElementById("cbParamVirtual1").value;
if (x=="1")
{
if(document.getElementById("caspioform")) {
  document.getElementById("caspioform").style.display = 'none';
document.getElementById('caspioform').submit();
}
}

</script>

Virtual field receives default value only on the first load, that is why search form will be hidden and auto-submitted only on the first load of the form, so if you hit "search again" link, you will be able to use search form as usual.

Hope that helps

Cheers! :)

Link to comment
Share on other sites

  • 3 weeks later...

One more question re this issue: If there are 2 submission forms deployed on the same web page then the code needs to be modified so it only affects the Search/Filter page. This will be an issue because the other submission form tries to submit a record on load (for example, if you have a submission form and a tabular report on the same web page and you want to use the above code to hide the tabular's search/filter page on load so the user goes straight to the results first).

I found this code in Caspio's reference- the mod is so you can delineate which submission form to affect. In my case the tabular datapage's search/filter form is the second actual 'submit form'. So you use document.forms[1] to point to it:

<script>
window.onload = function hide(){

}
var x = document.getElementById("cbParamVirtual1").value;
if (x=="1")
{
if(document.forms[1]) {
  document.forms[1].style.display = 'none';
document.forms[1].submit();
}
}

</script>

This code does make the tabular report's search/filter not show onload so it goes straight to the results. The problem is that, when the user clicks on the Search link (set in Results Options) it now won't open the Search/Filter form. It flashes to it but then comes back to the results. So there's some issue still. If anyone knows what to adjust that'd be really great. Thanks!

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