Jump to content

Remplir automatiquement le champs "donnez un titre a cette adresse"


yannml

Recommended Posts

Bonjour,

 

Suite a plusieurs tests, mes utilisateurs ont du mal à saisir l'interet de ce champ.

 

J'aimerais pouvoir remplir le champ "donnez un titre a cette adresse" automatiquement avec le nom-prenom saisi juste au dessus.

 

Auriez vous une idée de comment faire ca ?

 

Merci d'avance,

 

Yann

Link to comment
Share on other sites

Le fichier a modifier et le authentification.php

 

Voici mes champs prenom, nom et alias

 

 <p class="required text">
  <label for="customer_firstname">{l s='First name'}</label>
  <input onkeyup="$('#firstname').val(this.value);" type="text" class="text" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.post.customer_firstname)}{$smarty.post.customer_firstname}{/if}" />
  <sup>*</sup>
 </p>
 <p class="required text">
  <label for="customer_lastname">{l s='Last name'}</label>
  <input onkeyup="$('#lastname').val(this.value);" type="text" class="text" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" />

  <sup>*</sup>
 </p>

 <p class="required text" id="address_alias">
  <label for="alias">{l s='Assign an address title for future reference'} </label>
  <input type="text" class="text" name="alias" id="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{else}{l s='My address'}{/if}" />
  <sup>*</sup>
 </p>

 

Par contre, j'arrive pas a afficher le nom (ou encore mieu le "prenom-nom") automatiquement dans le champ Alias

Link to comment
Share on other sites

Bonjour Franck et merci pour ta reponse.

 

Si je change le 3eme imput comme ceci par exemple ca ne fonctionne pas, c'est comme ca que tu voyais la chose ?

 

 

<p class="required text" id="address_alias">  <label for="alias">{l s='Assign an address title for future reference'} </label>  <input type="text" class="text" name="alias" id="alias" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" />  <sup>*</sup> </p>

 

Link to comment
Share on other sites

en javascript :

 <p class="required text">
  <label for="customer_firstname">{l s='First name'}</label>
  <input onkeyup="$('#firstname').val(this.value);$('#alias').val($('customer_firstname').val()+' '+$('customer_lastname').val());" type="text" class="text" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.post.customer_firstname)}{$smarty.post.customer_firstname}{/if}" />
  <sup>*</sup>
 </p>
 <p class="required text">
  <label for="customer_lastname">{l s='Last name'}</label>
  <input onkeyup="$('#lastname').val(this.value);$('#alias').val($('customer_firstname').val()+' '+$('customer_lastname').val());" type="text" class="text" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" />

         <sup>*</sup>
 </p>

 

je n'ai pas testé le code

Link to comment
Share on other sites

Bonjour et merci webaide,

 

j'essayé et modifié ton code comme ceci :

 <p class="required text">  <label for="customer_firstname">{l s='First name'}</label>  <input onkeyup="$('#firstname').val(this.value);" type="text" class="text" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.post.customer_firstname)}{$smarty.post.customer_firstname}{/if}" />  <sup>*</sup> </p> <p class="required text">  <label for="customer_lastname">{l s='Last name'}</label>   <input onkeyup="$('#lastname').val(this.value);$('#alias').val($('customer_firstname').val()+' '+$('customer_lastname').val());" type="text" class="text" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" />  <sup>*</sup> </p>

 

 

L'objectif est proche, mais le resultat affiché dans le champs alias est "undefined undefined", et évidement le client ne s'appel pas "undefined" ;)

Link to comment
Share on other sites

c'est ma faute, il faut rajouter un # devant customer_firstname et customer_lastname comme ceci :

 

 <p class="required text">
  <label for="customer_firstname">{l s='First name'}</label>
  <input onkeyup="$('#firstname').val(this.value);$('#alias').val($('#customer_firstname').val()+' '+$('#customer_lastname').val());" type="text" class="text" id="customer_firstname" name="customer_firstname" value="{if isset($smarty.post.customer_firstname)}{$smarty.post.customer_firstname}{/if}" />
  <sup>*</sup>
 </p>
 <p class="required text">
  <label for="customer_lastname">{l s='Last name'}</label>
  <input onkeyup="$('#lastname').val(this.value);$('#alias').val($('#customer_firstname').val()+' '+$('#customer_lastname').val());" type="text" class="text" id="customer_lastname" name="customer_lastname" value="{if isset($smarty.post.customer_lastname)}{$smarty.post.customer_lastname}{/if}" />

	  <sup>*</sup>
 </p>

Edited by webaide (see edit history)
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...