Project

General

Profile

Download (1.49 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id $
2
// Author: Obslogic (Mike Smith aka Lionfish)
3

    
4
$(document).ready(function()
5
{
6
  var fieldid;
7
  $('span.expertsdb_addnode_form').hide();
8

    
9
  //the 'select from select box' has been selected
10
  $('a.expertsdb_addnode_select_link').click(function()
11
  {
12
    fieldid=this.id;
13
    $('select.expertsdb_addnode_select').filter('[@id='+fieldid+']').attr("disabled", false);
14
    $('input.expertsdb_addnode_source').filter('[@name=expertsdb_addnode_'+fieldid+']').val('');//clear to show not creating a node
15
    $('span.expertsdb_addnode_form').filter('.'+fieldid).hide();
16

    
17
  });
18

    
19
  //click on the general 'create new' links
20
  $('span.expertsdb_addnode_links').click(function()
21
  {
22
    fieldid=this.id;
23
    $('select.expertsdb_addnode_select').filter('[@id='+fieldid+']').attr("disabled", true);
24
    $('select.expertsdb_addnode_select').filter('[@id='+fieldid+']').selectNone();
25
  });
26

    
27
  //click on particular form type
28
  $('a.expertsdb_addnode_item').click(function()
29
  {
30
    var typeid=this.id;
31
    $('span.expertsdb_addnode_form').filter('[@id='+typeid+']').filter('.'+fieldid).siblings().hide();
32
    $('span.expertsdb_addnode_form').filter('[@id='+typeid+']').filter('.'+fieldid).show();
33
    $('input.expertsdb_addnode_source').filter('[@name=expertsdb_addnode_'+fieldid+']').val(typeid);
34
  });
35
});
36

    
37
//unselects every item in 'this'
38
jQuery.fn.selectNone = function()
39
{
40
  this.each(function()
41
  {
42
    for (var i=0;i<this.options.length;i++)
43
    {
44
      option = this.options[i];
45
      option.selected = false;
46
    }
47
  });
48
}
(7-7/47)