• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Whats the best way to get a drop down list in a web app submit form that would only contain user submited items of a specific field?

New Here ,
May 20, 2015 May 20, 2015

Copy link to clipboard

Copied

In other words a user would have submitted a list of charities in one web app and inside a web app submit form of another web app I would use the data source and show a drop-down of just the user submitted charities. The form generate HTML that's static but I would need it to pull that data source each time the form loads.

Here's what I got:

<label for="CAT_Custom_12">Donation To *</label>

                    <br>

                    <select name="CAT_Custom_12" id="CAT_Custom_12" class="cat_dropdown">

                        <option value=" ">-- Please select --</option>

                        <option value="9750717">charity 1</option>

                        <option value="10227843">New Test Charity</option>

                        <option value="8433417">Operation 300</option>

                        <option value="8433414">Pulse Outreach Ministry</option>

                        <option value="9753419">Pulse2</option>

                        <option value="8630371">TJ help</option>

                    </select>

I need the dropdown to load each option by pulling form the webapp item field when the form load. Ideally I would get it to load user submitted items only.

Any help or a point to some resources would be great.

TOPICS
Web apps

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2015 Jun 07, 2015

Copy link to clipboard

Copied

I could be wrong but I would try this:

Load the web app containing the charities inside the select html and call a template.

   

<select name="CAT_Custom_12" id="CAT_Custom_12" class="cat_dropdown">

{module_webapps id="charities" filter="all" template="/Layouts/custom/charities.tpl"}

  </select>


where the charities.tpl file contains:

  <option value="{tag_charityID}">{tag_name}</option>

It should print all the charities in the web app list each time. Is that what you mean? It doesn't strictly require liquid.

Or you can use liquid like this all on the one page:


{module_webapps id="charities" filter="all" template="" collection="charities"}


<select name="CAT_Custom_12" id="CAT_Custom_12" class="cat_dropdown">

{% for item in charities.items -%}

     <option value="{{item.charityID}}">{{item.name}}</option>

{% endfor -%}

  </select>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 10, 2015 Dec 10, 2015

Copy link to clipboard

Copied

where is CharityID value coming from?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 10, 2015 Dec 10, 2015

Copy link to clipboard

Copied

Hi klubjunky,

Sorry, my knowledge of liquid is slight - and now only slightly better than it was. Don't call the id by name, call it by ID number. And item.charitiesID should be item.itemID.

Also for customer submitted webapps, use module_webappscustomer instead of module_webapp.

Sorry for the mistakes.

I hope this helps.

{module_webappscustomer id="19964" filter="all" render="collection" collection="charities" template=""}

<select>

{% for item in charities.items -%}

     <option value="{{item.itemID}}">{{item.name}}</option>

{% endfor -%}

  </select>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 12, 2015 Dec 12, 2015

Copy link to clipboard

Copied

That's cool. I appreciate it.

I ended up using the old 'module' workaround.

do you know if this way you suggested will actually 'show' the already selected item if i'm EDITING the webapp?

Right now, using the dynamic method to get an updated list means the 'list' isn't available or 'visible' when the page is created..

so the value that was in the drop down get's lost...

This means I have to re-select the value in the dropdown - any time its in an edit page.

just curious if you or anyone has already sorted this one out.

I have been considering doing it in liquid, and creating ALL of the options and using capture or something. but i don't think that will work either..

It has to be a boring old un-dynamic list in order to work right.

which just isn't right

making edit fields that aren't dynamic is going to mean edits in the future

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 12, 2015 Dec 12, 2015

Copy link to clipboard

Copied

This code goes in the Edit template. This edits a data-source field that selects an item from a different webapp. It call module_webapp by using the datasource ID.

    {% comment -%} First preselect existing selection {% endcomment -%} 

<select name="CAT_Custom_000" id="CAT_Custom_000" class="cat_dropdown">

<option value="{tag_author_ID}" selected="selected"> {module_webapps,19963,i,{tag_author_ID} template="/Layouts/custom/datasource-name.tpl"}  </option>

{% comment -%} Then output the rest of the options {% endcomment -%}

   {module_webapps,19963,a,,,,true,,,1 template="/Layouts/custom/data-list.tpl"}

    </select>

Where datasource-name.tpl =

{tag_name_nolink}

Where data-list.tpl =

<option value="{tag_itemid}">{tag_name_nolink}</option>

That's it. This should be enough to go on.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 12, 2015 Dec 12, 2015

Copy link to clipboard

Copied

i'm trying this..

what is    tag_author_ID   ?

I understand it is supposed to be the user's identity who originally entered the webapp ..

but how is this information retrieved?

It isn't a tag that is anywhere

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 12, 2015 Dec 12, 2015

Copy link to clipboard

Copied

Or did you mean it to be like datasource id?

tag_author_id

{{datasource_id}}{tag_datasource_id}Renders the ID of the datasource field e.g. - if my datasource field is named country, the tag will be {tag_country_id}
{{datasource}}{tag_datasource}Renders a link to the datasource item e.g. - if my datasource field is named country, the tag will be {tag_country}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 12, 2015 Dec 12, 2015

Copy link to clipboard

Copied

OK

That's better. it does work AWESOME

thanks very much.

it is DATASOURCE_ID

so in my case, i was using modelname.

so it was

tag_modename_id

thanks very much for that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 29, 2017 Jan 29, 2017

Copy link to clipboard

Copied

Hi KlubJunky,

I having a need for this solution, but can't make sense of this thread. Can you assist?

Thanks, Teejay

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 29, 2017 Jan 29, 2017

Copy link to clipboard

Copied

Hi KlubJunky,

I figured everything out except for the part where only the webApps they submitted will show. Right now all in the database show.

Thanks, Teejay

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 29, 2017 Jan 29, 2017

Copy link to clipboard

Copied

LATEST

With my app name called "Individuals" I have the following which works like a charm!

<select name="CAT_Custom_12" id="CAT_Custom_12" class="cat_dropdown">

     <option value=" ">-- Please select --</option>

     {module_webappscustomer render="collection" id="Individuals" filter="all" sortType="ALPHABETICAL" collection="Individuals" template=""}

     {% for item in Individuals.items -%}

     <option value="{{item.itemid}}"> {{item.name}} </option>

     {% endfor -%}

</select>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines