<p>I believe what you need is the elementSelect field type which Craft bundles with the CMS. You can find the template of this field in <code>craft/app/templates/_includes/elementSelect.html</code></p>

<p>Here's a quick example that will get you started:</p>

<pre><code>{{ forms.elementSelectField({
    label: 'Select An Entry'|t,
    instructions: 'Select...'|t,
    id: 'entry',
    name: 'entry',
    elementType: craft.elements.getElementType("Entry"),
    source: '',
    criteria: '',
    sourceElementId: '',
    elements: '',
    storageKey: '',
    viewMode: 'list',
    limit: 1
 }) }}
</code></pre>

CC BY-SA 3.0
2016-10-07T13:55:09.477Z
Thanks i'll check that!  Where is the doc for this stuff?
Simon Müller
CC BY-SA 3.0
2016-10-07T14:05:27.287Z
@SimonMüller No problem. As far as I know there isn't any, it's just from my experience of reverse engineering these fields previously.
Stephen Hamilton
CC BY-SA 3.0
2016-10-07T11:59:35.663Z
2016-10-07T13:09:51.483Z
2016-10-07T13:09:51.483Z
Stephen Hamilton
<p>Hey I'm writing my first Craft plugin and would like to add a button to have a dialog box in <a href="https://i.sstatic.net/tAA1a.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tAA1a.png" alt="Choose an entry"></a>. I want to create a link to a page entry with this and save it to the database.</p>

<p>This is the code I want to extend in my template: </p>

<pre><code>{% import "_includes/forms" as forms %}

    &lt;div class="" style="width: 50%"&gt;
        &lt;form method="post" action="" accept-charset="UTF-8"&gt;
            &lt;input type="hidden" name="action" value="glossary/entry/saveEntry"&gt;
            &lt;input type="hidden" name="redirect" value="glossary"&gt;
            {{ forms.textField({
               label: 'Glossary Entry'|t,
               instructions: 'Enter a new Word'|t,
               id: 'entry',
               name: 'entry',
               value: ''}) }}
            &lt;input class="btn submit" type="submit" value="{{ 'Submit'|t }}"&gt;
        &lt;/form&gt;
    &lt;/div&gt;
</code></pre>

<plugins><control-panel><cp-dashboard>
Add an add entry button to my Plugin in Craft CP
# Add an add entry button to my Plugin in Craft CP

(Asked by: username_0 on 2016-10-07)

Hey I'm writing my first Craft plugin and would like to add a button to have a dialog box in . I want to create a link to a page entry with this and save it to the database.
This is the code I want to extend in my template: 
{% import "_includes/forms" as forms %}

    
        
            
            
            {{ forms.textField({
               label: 'Glossary Entry'|t,
               instructions: 'Enter a new Word'|t,
               id: 'entry',
               name: 'entry',
               value: ''}) }}

**Tags:** plugins, control-panel, cp-dashboard


---

## 1 answers

### Answer by username_1 on 2016-10-07. Score: 3 | Accepted answer

I believe what you need is the elementSelect field type which Craft bundles with the CMS. You can find the template of this field in craft/app/templates/_includes/elementSelect.html
Here's a quick example that will get you started:
{{ forms.elementSelectField({
    label: 'Select An Entry'|t,
    instructions: 'Select...'|t,
    id: 'entry',
    name: 'entry',
    elementType: craft.elements.getElementType("Entry"),
    source: '',
    criteria: '',
    sourceElementId: '',
    elements: '',
    storageKey: '',
    viewMode: 'list',
    limit: 1
 }) }}

> **Comments:**
> **username_0**: Thanks i'll check that!  Where is the doc for this stuff?  
> **username_1**: @SimonMüller No problem. As far as I know there isn't any, it's just from my experience of reverse engineering these fields previously.  

---

