Forum

Thread tagged as: Problem, Field-Types

perch tag self closing slash gets removed in output

Hi,

I'm trying to set a link to a file that the client has uploaded. But by putting the perch file tag within my href, the link just breaks.

This is my HTML

<a data-popup="true" href="<perch:content id="factuurvoorwaarden" type="file" label="Factuurvoorwaarden PDF" />">factuurvoorwaarden</a>

This renders out to

<a data-popup="true" href="<perch:content id=" factuurvoorwaarden"="" type="file" label="Factuurvoorwaarden PDF">">factuurvoorwaarden</a>

As you can see the closing slash of the perch tag gets removed and the "great/smaller then" signs get replaced by their entity codes. Using this within a form, using the same HTML does work, but removes the data-popup attribute. Though that attribute is not the problem, since I have tried this without and with a target="_blank" (this gets removed as well). So i'm also not able to have it open in a new tab (this is necessary).

Any idea's as to what the issue is?

Thanks in advance!

Robin

Robin Vinckx

Robin Vinckx 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Where are you doing this? Is it in a template?

This example is just inside the body of my index.php. The other, where I use this link at the bottom of a form (this is for terms&conditions pdf) is inside a perch region. Inside of the form the tag has the correct output, but removes my data or target attribute (whichever i use).

Rachel Andrew

Rachel Andrew 394 points
Perch Support

You can only use Perch template tags in a Perch template, not in your page.

Ok thanks for the clarification. My form is in a template and the tag does seem to work there without a problem. But still. All attributes I add to the a-tag seem to get removed. Why is that?

<a data-popup="true" href="<perch:content id="factuurvoorwaarden" type="file" label="Factuurvoorwaarden PDF" />">factuurvoorwaarden</a>

This piece of HTML

<a href="/perch/resources/factuurvoorwaarden.pdf">factuurvoorwaarden</a>

Gets outputted like this. Notice the "data-popup" attribute has been removed. The same happens if I add (for example) target="_blank".

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Can we see your entire template and Diagnostics Report?

Of course.

TEMPLATE:

<div class="pages-content__form">
    <h4 class="pages-content__form__title"><perch:content id="form_contact_title" type="text" label="Form title"/></h4>
    <perch:form id="form_coaching_workshop_2" method="post" app="perch_forms" class="md__form">
        <div class="md__form__col md__form__col-1-of-2">
            <perch:label class="md__form__label" for="naam">Naam</perch:label>
            <perch:input class="md__form__input" id="naam" type="text" required="true" label="Naam" maxlength="30"/>
        </div>
        <div class="md__form__col md__form__col-1-of-2">
            <perch:label class="md__form__label" for="voornaam">Voornaam</perch:label>
            <perch:input class="md__form__input" id="voornaam" type="text" required="true" label="Voornaam" maxlength="30"/>
        </div>
        <perch:label class="md__form__label" for="email">E-mail</perch:label>
        <perch:input class="md__form__input" id="email" type="email" required="true" label="E-mail" pattern="^\S+@\S+\.\S+$" maxlength="30"/>
        <div class="md__form__col md__form__col-3-of-4">
            <perch:label class="md__form__label" for="straat">Straat</perch:label>
            <perch:input class="md__form__input" id="straat" type="text" required="true" label="Straat" maxlength="30"/>
        </div>
        <div class="md__form__col md__form__col-1-of-4">
            <perch:label class="md__form__label" for="nummer">Nummer</perch:label>
            <perch:input class="md__form__input" id="nummer" type="number" required="true" label="Nummer"  maxlength="6"/>
        </div>
        <div class="md__form__col md__form__col-3-of-4">
            <perch:label class="md__form__label" for="stad">Stad</perch:label>
            <perch:input class="md__form__input" id="stad" type="text" required="true" label="Stad" maxlength="30"/>
        </div>
        <div class="md__form__col md__form__col-1-of-4">
            <perch:label class="md__form__label" for="postcode">Postcode</perch:label>
            <perch:input class="md__form__input" id="postcode" type="number" required="true" label="Postcode"  maxlength="6"/>
        </div>
        <perch:label class="md__form__label" for="btw">BTW Nummer (indien BTW plichtig)</perch:label>
        <perch:input class="md__form__input" id="btw" type="text" required="true" label="BTW Nummer" maxlength="30"/>

        <perch:label class="md__form__label" for="message">Overige opmerkingen of vragen?</perch:label>
        <perch:input class="md__form__textarea" id="message" type="textarea" required="true" label="Message" maxlength="1000" />

        <perch:input type="checkbox" id="factuurvoorwaarden" label="Factuurvoorwaarden" required="true" />
        <span class="md__form__checkbox__label">Ik ga akkoord met de <a data-popup="true" href="<perch:content id="factuurvoorwaarden" type="file" label="Factuurvoorwaarden PDF" />">factuurvoorwaarden</a></span>

        <perch:input class="md__form__button btn btn--secondary" type="submit" id="submit" value="Verzenden" />
    </perch:form>
</div>

DIAGNOSTICS:

PERCH INFORMATION

Perch: 2.8.31
Production mode: Production (100)
Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_forms (1.8.3)
DB driver: PDO
DB tables: perch2_categories (0), perch2_category_counts (0), perch2_category_sets (0), perch2_content_index (258), perch2_content_items (44), perch2_content_regions (10), perch2_forms (8), perch2_forms_responses (11), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (1), perch2_pages (1), perch2_resource_log (158), perch2_resource_tags (0), perch2_resources (32), perch2_resources_to_tags (0), perch2_settings (10), perch2_user_passwords (0), perch2_user_privileges (29), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_forms'
    );
Editor plug-ins: markitup
H1: 3d85381a0ec251211bff6c52f460c76d
L1: dd42d3d41f2f5fd1cb00ce9b33b4a2ae
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
update_2.8.31: done
latest_version: 2.8.15
on_sale_version: 2.8.32
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: db_jokespaas
PERCH_DB_PREFIX: perch2_
PERCH_TZ: Europe/Brussels
PERCH_EMAIL_FROM: robinvx1@gmail.com
PERCH_EMAIL_FROM_NAME: Robin Vinckx
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/ecommerce/Code/littlelowland/sites/jokespaas/perch
PERCH_CORE: /Users/ecommerce/Code/littlelowland/sites/jokespaas/perch/core
PERCH_RESFILEPATH: /Users/ecommerce/Code/littlelowland/sites/jokespaas/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_EMAIL_METHOD: smtp
PERCH_EMAIL_HOST: mailtrap.io
PERCH_EMAIL_SECURE: tls
PERCH_EMAIL_AUTH: 1
PERCH_EMAIL_PORT: 2525
PERCH_EMAIL_USERNAME: 3b38e1b8e706b7
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/ecommerce/Code/littlelowland/sites/jokespaas/perch/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 5.6.28
Zend: 2.6.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.5.5-10.1.19-MariaDB
Free disk space: 94.73 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, fileinfo, filter, ftp, gd, gettext, SPL, iconv, session, json, ldap, mbstring, mcrypt, standard, mysqlnd, mysqli, mysql, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, Phar, posix, Reflection, imap, shmop, SimpleXML, soap, sockets, exif, sybase_ct, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, apache2handler, mhash
GD: Yes
ImageMagick: No
PHP max upload size: 128M
PHP max form post size: 128M
PHP memory limit: 128M
Total max uploadable file size: 128M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
UNIQUE_ID: WEh1VsCoAQgAAAL90d0AAAAG
HTTP_HOST: jokespaas.local
HTTP_CONNECTION: keep-alive
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_REFERER: https://jokespaas.local/perch/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
HTTP_COOKIE: cmssb=0; cmsa=1; PHPSESSID=h58bb2n6q0tipbnqmq4f37kqh5
PATH: /usr/bin:/bin:/usr/sbin:/sbin
DYLD_LIBRARY_PATH: /Applications/XAMPP/xamppfiles/lib
SERVER_SOFTWARE: Apache/2.4.23 (Unix) OpenSSL/1.0.2j PHP/5.6.28 mod_perl/2.0.8-dev Perl/v5.16.3
SERVER_NAME: jokespaas.local
SERVER_ADDR: 127.0.0.1
SERVER_PORT: 80
REMOTE_ADDR: 127.0.0.1
DOCUMENT_ROOT: /Users/ecommerce/Code/littlelowland/sites/jokespaas
REQUEST_SCHEME: http
CONTEXT_DOCUMENT_ROOT: /Users/ecommerce/Code/littlelowland/sites/jokespaas
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME: /Users/ecommerce/Code/littlelowland/sites/jokespaas/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 49627
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1481143638.326
REQUEST_TIME: 1481143638
Drew McLellan

Drew McLellan 2638 points
Perch Support

You'll need to double-check what you're seeing - Perch doesn't even have the capability to modify the markup in your template outside of its own tags.