It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

PocketQuery - how would I create radio buttons in a template for dynamic parameter changes

Eugene Domingo Nov 04, 2014

I'm very new to html and database queries.  I understand how to create a radio button.  But how would I pass that parameter into the query?

I have this radio button:

<input name="Provider" value="All" type="radio" checked="checked">

I'm pretty sure I may have to use some sort of get function, but I don't know the syntax.  Maybe value="$!req.getParameter(Provider)"?

I been reviewing the PocketQuery documentation and I cannot make out much on further customizing the templates for something like this.  The default template in the documentation seems to run through a loop to display the parameters.  But I would like to create parameters that I can place in specific areas of the page through formatting.

I might also ask, is passing the parameter the same way with a text field?

2 answers

1 accepted

3 votes
Answer accepted
Felix Grund Nov 05, 2014

Hi Eugene!

I created a sample template with radio buttons for you. This is my query:

SELECT Name, Continent, Population
FROM Country
WHERE Continent = :continent

This is my template:

<form method="get" class="aui pq-dynamic-parameter-form" action="">
	<h4>Change the continent here:</h4>
	<div>
		Europe<input type="radio" name="pq_continent" value="Europe">
		Africa<input type="radio" name="pq_continent" value="Africa">
		Oceania<input type="radio" name="pq_continent" value="Oceania">
	</div>
	<button type="submit" class="pq-change-button aui-button aui-style aui-button-primary">GO</button>
</form>

$PocketQuery.template("default")

This is my macro browser:

screenshot2.png

This is my view when I click the radio "Africa" and "GO":

screenshot.png

It works perfectly smile

Eugene Domingo Nov 06, 2014

Thanks. This works for what I need.

Felix Grund Nov 11, 2014

Hey Eugene! If you like PocketQuery, would you consider leaving a review at the Atlassian marketplace? We'd be very glad ;).

Eugene Domingo Nov 11, 2014

Done. Thanks. You guys have a great product here.

0 votes
Felix Grund Nov 04, 2014

Hi Eugene!

In our article PocketQuery Templating, we're describing how to changes the parameters dynamically in the section "Dynamic Parameter Change". Please check that out.

Regards, Felix [Scandio]

Eugene Domingo Nov 04, 2014

I've looked at it but could not figure it out because it's using text fields. It doesn't explain how the parameter is transferred from the template to the query. It may be something I'm not seeing since I'm still a beginner. I'm wondering if I'm missing something in my above code?

Felix Grund Nov 04, 2014

Just use an input with type "radio" instead of "text". Clicking the Change button will then submit the form and use GET parameters in the URL to set up your query parameters. Note that for this you must check the "Enable dynamic parameters" checkbox in your macro parameters.

Eugene Domingo Nov 04, 2014

I have the radio button above: <input name="Provider" value="All" type="radio" checked="checked"> And that's the other thing, I don't know how to use GET parameters in the URL. That's something I'm still learning. Currently I'm researching the web, like w3schools.com on examples of html coding. But the issue I have is implementing that with PocketQuery.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

168 views 21 10
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you