Improves sector related JS in profile edition.
authorStéphane Jacob <sj@m4x.org>
Mon, 7 Jun 2010 16:17:12 +0000 (18:17 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 7 Jun 2010 16:17:12 +0000 (18:17 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
htdocs/javascript/profile.js
templates/profile/jobs.job.tpl
templates/profile/jobs.sector.tpl

index 4b215f6..3277589 100644 (file)
@@ -499,6 +499,16 @@ function updateJobAlternates(id)
     }
 }
 
+function emptyJobSubSector(id)
+{
+    Ajax.update_html('job_' + id + '_subSubSector', 'profile/ajax/sub_sector/' + id + '/-1/-1');
+}
+
+function emptyJobAlternates(id)
+{
+    Ajax.update_html('job_' + id + '_alternates', 'profile/ajax/alternates/' + id + '/-1');
+}
+
 function displayAllSector(id)
 {
     $('.sector_text_' + id).remove();
index 2d29790..ec4008f 100644 (file)
     <tr class="pair {$sector}" style="display: none">
       <td class="titre" rowspan="4">Secteur&nbsp;d'activité</td>
       <td>
-        <select name="{$jobpref}[sector]" onchange="updateJobSector({$i}, '')">
+        <select name="{$jobpref}[sector]" onchange="updateJobSector({$i}, ''); emptyJobSubSector({$i}); emptyJobAlternates({$i});">
           <option value="0">&nbsp;</option>
           {foreach from=$sectors item=item}
           <option value="{$item.id}" {if $item.id eq $job.sector}selected="selected"{/if}>
index e12c3dc..f22a6ff 100644 (file)
@@ -21,7 +21,7 @@
 {**************************************************************************}
 
 <?xml version="1.0" encoding="utf-8"?>
-<select name="jobs[{$id}][subSector]" {if ($change)}onchange="updateJobSubSector({$id}, '')"{/if}>
+<select name="jobs[{$id}][subSector]" {if ($change)}onchange="updateJobSubSector({$id}, ''); emptyJobAlternates({$id});"{/if}>
   <option value="0">&nbsp;</option>
   {iterate from=$subSectors item=subSector}
   {if $subSector.optgroup}