PocketQuery: How to disable auto load even when "Load macro dynamically" and "Use change params template" options are un-checked
Asked by Pranjal Shukla:

I have incorporated "Change Params Template" as part of my Custom Template hence i have only checked "Enable dynamic parameters" in Macro Definition on the page. I don't want PQ to execute query on page load as it is a complex one and takes time. How can i "Disable Auto Load" from the Custom Template i have made?  
[](https://community.atlassian.com/t5/Confluence-questions/PocketQuery-How-to-disable-auto-load-even-when-quot-Load-macro/qaq-p/188575?attachment-id=9448){#link_1186da3f87fb7b}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/31652/1/pranjal.txt){#display_1186da3f87fb7b_0}  
[](https://community.atlassian.com/t5/Confluence-questions/PocketQuery-How-to-disable-auto-load-even-when-quot-Load-macro/qaq-p/188575?attachment-id=9449){#link_1186da3f87fb7b_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/31652/2/image2016-6-28%2017%3A2%3A14.png){#display_1186da3f87fb7b_2}


Answers:
author: Felix Grund (Scandio)
body: Hi Pranjal,

I created a new beta release for PocketQuery 2.1.1. You can find it [here](https://cloud.scandio.de/index.php/s/8t8eVpz9fGHxYoi). With this version, the only requirement for "disable autoload" will be "dynamic load". So you should be able to use it properly with your own form. Besides that, the issue that fields in the form won't appear if you didn't enter anything should be fixed as well.

Please let check it out and provide me some feedback as always :smile:. Thanks for your support!

Regards, Felix (Scandio)

comments: author: Pranjal Shukla
body: Felix,

Here are the observations:

* Preview does not load with "Disable autoload" set to true.
* Since i have my custom form in template, i have disabled (unchecked) "Use change params template". With this unchecked, my custom form does not appear.
* When i check (enable) "Use change params template", I see default form of PQ despite my form there in the template.
* When i search using the default form, the results get loaded along with my custom form.

It seems that template associated with a query is getting loaded/executed only when result is being displayed.

Have a look at the Snapshot below:

image2016-6-28 17:2:14.png


author: Pranjal Shukla
body: Felix,

I guess the template always loads at the time of results. Since i have my default values defined as junk (in prod instance), the query returns empty result on page load along with a message and my form along with this. This gives an impression that form is loading on the page load but actually that's not the case.

This scenario changes when you check "disable auto load" and uncheck "Show change params template", you actually don't see anything.

Also, if you are just executing standalone query like "select \* from emp;" and "disable auto load", you'll see a blank page which is obvious and users will not even get to know that there is a macro there. Ideally for queries without parameters, there should be some way to execute queries with Auto Load disabled.

OR, "Disable auto load" should be kept for queries only with parameters not with others.

I may not have explained the case in proper order but hope you get the gist.

The only reason i defined my custom form was:

* To have field names in bold.
* Hide default values.
* Change the name of button to Search.


author: Felix Grund (Scandio)
body: I see what you are saying with "disable autoload". Maybe you can try it with simple CSS and JS and use the default change params template:

```
&lt;style&gt;.pq-dynamic-parameter-form label { font-weight: bold; }&lt;/style&gt;$PocketQuery.template("default")&lt;script&gt;jQuery('.pq-change-button').text('My Button');jQuery('.pq-dynamic-parameter-form input').val('');&lt;/script&gt;
```

However, there will be a delay until this is really done...


author: Felix Grund (Scandio)
body: Another workaround would be to use two queries. One is only for the form and is kind of a dummy query like "SELECT 1". In the template with the form, you can use JS to render another query that actually produces the result. I put up an example for someone else one day that you can find here:

Maybe this helps.


author: Felix Grund (Scandio)
body: Hi Pranjal,

Thanks for remembering! How about checking DynamicLoad AND ChangeParams and simply hiding the ChangeParams form with CSS in the template?

```
&lt;style&gt;.pq-dynamic-parameter-form { display: none; }&lt;/style&gt;
```

Regards, Felix

comments: author: Pranjal Shukla
body: Felix, it did not work, let me tel you why.

I also have a custom form with the same class i.e. *class="aui pq-dynamic-parameter-form"*. So i changed this class name, enabled "Change Params Template", "Dynamic Load" and Disabled "Auto Load". I added the script you gave me in my custom template. The moment i did this, my form got masked by the default form that comes when you enable "Change Params Template".

Ideally, the default should be hidden and the one i made should be visible.


author: Felix Grund (Scandio)
body: > my form got masked by the default form that comes when you enable "Change Params Template"

Sorry, I'm a little lost. You hide the default form .pq-dynamic-parameter-form with CSS. You give your form a different class. I would think the default form would now be hidden and your form would be visible?


author: Pranjal Shukla
body: Even if i change the class name of my custom form, my custom form is getting hidden and the default one starts appearing.

One more observation, when **"Disable AutoLoad"** is set to **true** and no value in the Default Value field, the text fields are not appearing on the page and only **Change** button is appearing.

We can have a quick GoTo meeting session if you are available for 5 mins. I can send you an invite. What do you say?


author: Pranjal Shukla
body: Felix,

Please do let me know your suggestions here.


author: Felix Grund (Scandio)
body: Hi Pranja, I will reproduce this on my local system during the next days. I'll let you know.


author: Felix Grund (Scandio)
body: Thanks for the feedback, Pranjal. DynamicLoad and ChangeParams are currently required unfortunately. It's on the roadmap to enhance this feature. I think you could find a workaround with ChangeParams unchecked (I can help you with that if you want). But DynamicLoad is definitely required currently.

comments: author: Pranjal Shukla
body: That would be great Felix. Currently i have given some special characters in the Default value of parameters for which i know there are no related records in the DB. When the page loads, it loads with the form but with a message as "Query was executed successfully, the result set was empty". This confuses users as they don't know what this message is and what query it is talking about, i need to explain them (As many are from non technical background).

BTW, i did try the method of pasting the JQuery code (Custom HTML at the end of the page) mentioned on other ticket but it did not work.


author: Pranjal Shukla
body: Felix,

I am waiting for your help on this.


Tags: confluence-administration

pocketquery