I'm working on a website that has a simple form consisting of an input field, where an email address can be entered, and a submit button in the footer. The button leads to a contact page with a Powermail form. The form has an input field where the value from the footer input would get carried over.
The problem I have is that I don't know how to carry over the value from the input field from one page to the input field of another. One thing I've noticed is that if the submit button has a value that it gets carried over. However, I don't know how to get the value from the input element.
Here's the footer form:
<f:form action="email" pluginName="tx_powermail_pi1" controller="Form" method="post" pageUid="26" class="uk-flex">
<div class="uk-width-1-2">
<f:form.textfield name="tx_powermail_pi1[field][email]" value="{email}" placeholder="Your email ..." <div class="uk-width-1-2">
<f:form.button type="submit" value="{email}" name="tx_powermail_pi1[field][email]" class="uk-button uk-button-primary button-newsletter">
Anmelden
</f:form.button>
</div>
<f:form.hidden value="1" name="tx_powermail_pi1[type]"/>
<f:form.hidden value="1" name="no_cache"/>
</f:form>
Here's the Powermail form from the contact site how it gets displayed on the page:
<form data-parsley-validate="data-parsley-validate" data-validate="html5" enctype="multipart/form-data" name="field" class="powermail_form powermail_form_1"
action="/newsletter?tx_powermail_pi1%5Baction%5D=create&tx_powermail_pi1%5Bcontroller%5D=Form&cHash=838bac372f487bb18decb49eba8a9643#c35" method="post" novalidate="">
<fieldset class="powermail_fieldset powermail_fieldset_1 nolabel">
…
<div class="powermail_fieldwrap powermail_fieldwrap_type_input powermail_fieldwrap_email">
<label for="powermail_field_email" class="powermail_label" title="">
Email
</label>
<div class="powermail_field">
<input required="required" aria-required="true"
data-parsley-required-message="Dieses Feld muss ausgefüllt werden!" data-parsley-trigger="change"
data-parsley-error-message="Keine gültige E-Mail-Adresse!" class="powermail_input"
id="powermail_field_email" type="email" name="tx_powermail_pi1[field][email]" value=""></div>
</div>
<div class="powermail_fieldwrap powermail_fieldwrap_type_submit powermail_fieldwrap_send ">
<div class="powermail_field "><input class="powermail_submit" type="submit" value="Absenden"></div>
</div>
</fieldset>
<input class="powermail_form_uid" type="hidden" name="tx_powermail_pi1[mail][form]" value="1">
</form>
solved: The solution to this is to remove the name attribute from the submit button. The value of the input field then gets carried over to the other page.
This is how the code looks like now:
<f:form action="email" pluginName="tx_powermail_pi1" controller="Form" method="post"
pageUid="26" class="uk-flex">
<div class="uk-width-1-2">
<f:form.textfield id="powermail_field_email" name="tx_powermail_pi1[field][email]" value="{email}"
placeholder="Your email ..." type="email"/>
</div>
<div class="uk-width-1-2">
<f:form.button type="submit" class="uk-button uk-button-primary button-newsletter">
Anmelden
</f:form.button>
</div>
<f:form.hidden value="1" name="tx_powermail_pi1[type]"/>
<f:form.hidden value="1" name="no_cache"/>
</f:form>