Guest User

Untitled

a guest
Feb 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <div class="form-group row">
  2. <label class="col-md-3 form-control-label">{l s='Subject'
  3. d='Shop.Forms.Labels'}</label>
  4.  
  5. <div class="col-md-6">
  6.  
  7. <select id="id_contact" name="id_contact"
  8. onchange="showElemFromSelect('id_contact', 'desc_contact')">
  9. <option value="0">{l s='Choisir...'}</option>
  10. {foreach from=$contact.contacts item=contact_elt}
  11. <option value="{$contact_elt.id_contact|intval}" {if
  12. isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact_elt.id_contact}selected="selected" {/if}>{$contact_elt.name}</option>
  13. {/foreach}
  14. </select>
  15.  
  16. </div>
  17.  
  18. {foreach from=$contact.contacts item=contact_elt }
  19. <div id="desc_contact" style="display:none;">
  20. <p class="
  21. {$contact_elt.id_contact|intval}_desc_contact_p">
  22. {$contact_elt.description}
  23. </p>
  24. </div>
  25. {/foreach}
  26.  
  27. </div>
  28.  
  29. function showElemFromSelect(select_id, elem_id)
  30. {
  31. var select = document.getElementById(select_id);
  32. for (var i = 0; i < select.length; ++i)
  33. {
  34. var elem = document.getElementById(elem_id + select.options[i].value);
  35. if (elem != null)
  36. toggle(elem, i == select.selectedIndex);
  37. }
  38. }
Add Comment
Please, Sign In to add comment