Hi,
are there any restrictions regarding the generation of URLs with link tags where the ID is provided by a placeholder? I used this construct quite often, but now it lets me down...
I have a page (resource) that includes a form defined in a chunk:
[[$DirectApplicationForm? &jobResId=`[[!getReqParam? &name=`position` &type=`GET`]]` ]]
"position" is a GET parameter holding a resource ID.
The chunk looks like this (it uses FormIt / FormitFastPack):
[[!FormIt?
&hooks=`spam,fiProcessArrays,fiGenerateReport,email,redirect`
&errTpl=`<p class="ym-message">[[+error]]</p>`
&validationErrorMessage=`<p class="errorMessageBox">Es ist ein Fehler aufgetreten. Bitte überprüfen Sie die Werte, die Sie in das Formular eingegeben haben.</p>`
&emailTpl=`DirectApplicationEmailTpl`
&emailTo=`[[++emailsender]]`
&redirectTo=`[[++cfg.directApplicationFormRedirectId]]`
&emailFrom=`[email protected]`
&emailFromName=`MODX Revolution CMS`
&emailToName=`My customer's company name`
&emailSubject=`Website-Formular: Direkt bewerben`
&emailHtml=`0`
&store=`1`
&storeTime=`180`
&validate=`aspiredPosition,
appellation:required,
title,
firstName:required,
surname:required,
street,
addressAddition,
zipCode,
city,
country,
phone:required,
email:required:email,
comments,
priority,
attachment,
confirmation:required`
&submitVar=`submitForm`
&figrTpl=`formReportRow`
]]
<form action="[[~[[*id]]]]" method="post" enctype="multipart/form-data" id="directApplicationForm" class="ym-form ym-columnar">
[[!fieldSetDefaults?
&outer_class=`ym-fbox-`
&error_class=`ym-error`
]]
[[!+fi.validation_error_message]]
<p>Die durch einen Stern (<span class="requiredFieldIndicator">*</span>) gekennzeichneten Felder sind Pflichtfelder und müssen von Ihnen ausgefüllt werden.</p>
[[!+fi.error.error_message:notempty=`<p>[[!+fi.error.error_message]]</p>`]]
<fieldset>
[[!field?
&type=`hidden`
&outer_tpl=``
&name=`nospam:blank`
]]
[[!field?
&type=`text`
&name=`aspiredPosition`
&label=`Gewünschte Position`
&default=`[[!getResourceField?
&id=`[[+position]]`
&field=`JobName`
&isTV=`1`
&default=``
]]`
]]
[[!field?
&type=`hidden`
&name=`positionUrl`
&default=`[[++site_url]] - [[+jobResId]] - [[~24]] - [[~[[!+jobResId]]]]`
]]
[...]
[[!field?
&type=`text`
&name=`firstName`
&label=`Vorname`
&required=`1`
]]
[[!field?
&type=`text`
&name=`surname`
&label=`Nachname`
&required=`1`
]]
</fieldset>
[...]
<fieldset>
[[!field? &type=`submit` &name=`submitForm` &label=`noLabel` &value=`Jetzt absenden` &class=`ym-button ym-save`]]
</fieldset>
</form>
I left some parts of the form out; they shouldn't make a difference.
The interesting part is the hidden field named positionUrl. The notation
&default=`[[++site_url]] - [[+jobResId]] - [[~24]] - [[~[[!+jobResId]]]]`
has been chosen purpously (for testing). The site URL is generated correctly, so is the ID represented by the placeholder jobResId and the path to the resource with the ID 24. [[~[[!+jobResId]]]] instead leads to an empty string, with or without the exclamation mark:
<input type="hidden" name="positionUrl" value="http://mycustomersdomain.tld/ - 24 - jobs/teamleiter-vertriebsinnendienst-m-w.html - " />
Okay, I tried to generate the part of the URL in the resource and bring it into the chunk via an additional placeholder:
[[$DirectApplicationForm?
&jobResId=`[[!getReqParam? &name=`position` &type=`GET`]]`
&jobResUrl=`[[~[[!getReqParam? &name=`position` &type=`GET`]]]]`
]]
But
&default=`[[++site_url]][[+jobResUrl]]`
doesn't work either...
Maybe I'm just too tired by now, but I don't understand why this leads to an empty string. I'd appreciate it very much if someone could push me in the right direction!
Cheers,
Jan