Jump to content

Custom contact formulier velden auto en verplicht


Recommended Posts

Hoi,

 

Met prestashop ben ik nog vrij nieuw, maar ik moet zeggen dat het met een hoop zoeken best goed komt.

Toch zit ik nu met een probleem.

Zelf heb ik een contactformulier in elkaar gezet door wat dingen te combineren.

Nu wil ik graag nog twee dingen.

  1. velden verplicht maken
  2. automatisch ingevulde velden als iemand is ingelogd

Heeft iemand misschien een idee hoe ik dit moet doen in de code?

 

Alvast bedankt!

 

Hieronder de code van mijn formulier tot nu toe:

 

<h1>{l s='Klantenservice'} - {if isset($customerThread) && $customerThread}{l s='Your reply'}{else}{l s='Contact us'}{/if}</h1>
{if isset($confirmation)}
<p>{l s='Your message has been successfully sent to our team.'}</p>
<ul class="footer_links">
 <li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li>
</ul>
{elseif isset($alreadySent)}
<p>{l s='Your message has already been sent.'}</p>
<ul class="footer_links">
 <li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li>
</ul>
{else}
<p class="bold">{l s='Voor vragen over producten, bestellingen of  Bedelz.nl kunt u onderstaand contactformulier gebruiken.'}.</p>
<br>
{include file="$tpl_dir./errors.tpl"}
<form action="{$request_uri|escape:'htmlall':'UTF-8'}" method="post" class="std" enctype="multipart/form-data">
 <fieldset>
	<h3>Bericht versturen</h3>
  <p class="select">
<label for="id_contact">{l s='Subject Heading'} <font color="#CC0000" size="+1">*</font></label>
  {if isset($customerThread.id_contact)}
{foreach from=$contacts item=contact}
 {if $contact.id_contact == $customerThread.id_contact}
  <input type="text" id="contact_name" name="contact_name" value="{$contact.name|escape:'htmlall':'UTF-8'}" readonly="readonly" />
  <input type="hidden" name="id_contact" value="{$contact.id_contact}" />
 {/if}
{/foreach}
  </p>
  {else}
<select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">
 <option value="0">{l s='-- Choose --'}</option>
{foreach from=$contacts item=contact}
 <option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</select>
  </p>
  {/if}
	<p class="text">
	<label for="name">Voornaam <font color="#CC0000" size="+1">*</font></label>
	<input type="text" id="name" name="name" value="">
	</p>
	<p class="text">
	<label for="lastname">Achternaam <font color="#CC0000" size="+1">*</font></label>
	<input type="text" id="lastname" name="lastname" value="">
	</p>
	<p class="text">
	<label for="email">Uw e-mailadres <font color="#CC0000" size="+1">*</font></label>
	<input type="text" id="email" name="from" value="">
	</p>
	<p class="text">
	<label for="street">Straat + huisnr.</label>
	<input type="text" id="street" name="street" value="">
	</p>
	<p class="text">
	<label for="zipcode">Postcode</label>
	<input type="text" id="zipcode" name="zipcode" value="" style="width:60px;" maxlength="7">
	</p>
	<p class="text">
	<label for="city">Plaats</label> <input type="text" id="city" name="city" value="">
	</p>
	<p class="text">
	<label for="order">Bestelnummer</label> <input type="text" id="order" name="order" value="">
	</p>
	<p class="textarea">
	<label for="message">Uw bericht <font color="#CC0000" size="+1">*</font></label>
	<textarea cols="20" id="message" name="message" rows="15" style="width:340px;height:220px"></textarea>
	</p>
	<p class="submit"> <input type="submit" name="submitMessage" id="submitMessage" value="Verzend bericht" class="button_large" onclick="$(this).hide();">
	</p>
	<font color="#CC0000" size="+1">*</font> Verplichte velden
</fieldset>
</form>
{/if}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...