Changeset 570 for trunk/web-app


Ignore:
Timestamp:
Jun 16, 2010, 3:09:42 PM (10 years ago)
Author:
vinlud
Message:

Dynamic forms controls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web-app/js/simpleQuery.js

    r547 r570  
    1313
    1414  $(document).ready(function() {
     15
     16    var compoundCounter = 2;
     17    var transcriptomeCounter = 2;
     18
    1519    $("#accordion").accordion({collapsible: true,
    1620        autoHeight: false,
    1721        active: false});
    1822
    19     $('#addCompound').submit(function() {
    20         alert('Handler for adding compound called');
     23    $('#addCompound').click(function() {
     24        var compoundGroup = document.getElementById('compoundGroup');
     25
     26        var newCompoundDiv = document.createElement('div');
     27        newCompoundDiv.setAttribute('id', 'compoundRow' + compoundCounter);
     28
     29        newCompoundDiv.innerHTML = '<div class="description">Compound</div> <div class="input"><input type="text" name="compound" value=""></div> <div class="description">Value</div> <div class="input"><input id="compoundValue' + compoundCounter + '" type="text"></div>';
     30
     31        compoundGroup.appendChild(newCompoundDiv);
     32
     33        compoundCounter++;
     34        // alert('Handler for adding compound called: ' + compoundCounter);
    2135        return true;
    2236    });
    2337
    24     $('#addTransciptome').submit(function() {
    25         alert('Handler for adding transcriptome called');
    26         return true;
    27     });
     38      $('#addTranscriptome').click(function() {
     39          var transcriptomeGroup = document.getElementById('transcriptomeGroup');
     40          var newTranscriptomeDiv = document.createElement('div');
     41
     42          newTranscriptomeDiv.setAttribute('id', 'transcriptomeRow' + transcriptomeCounter);
     43
     44          var newTranscriptomeRowDiv1 = document.createElement('div');
     45          newTranscriptomeRowDiv1.setAttribute('class', 'description');
     46          newTranscriptomeRowDiv1.innerHTML = "Gene/pathway";
     47          newTranscriptomeDiv.appendChild(newTranscriptomeRowDiv1);
     48
     49          var newTranscriptomeRowDiv2 = document.createElement('div');
     50          newTranscriptomeRowDiv2.setAttribute('class', 'input');
     51          newTranscriptomeRowDiv2.innerHTML = '<input type="text" name="genepath" value="">';
     52          newTranscriptomeDiv.appendChild(newTranscriptomeRowDiv2);
     53
     54          var newTranscriptomeRowDiv3 = document.createElement('div');
     55          newTranscriptomeRowDiv3.setAttribute('class', 'description');
     56          newTranscriptomeRowDiv3.innerHTML = "Type of regulations";
     57          newTranscriptomeDiv.appendChild(newTranscriptomeRowDiv3);
     58
     59          var newTranscriptomeRowDiv4 = document.createElement('div');
     60          newTranscriptomeRowDiv4.setAttribute('class', 'input');
     61          var newSelectBox = document.getElementById('regulation');
     62          newTranscriptomeRowDiv4 = newSelectBox.cloneNode(true);
     63          newTranscriptomeRowDiv4.setAttribute('id', 'regulation' + transcriptomeCounter);
     64          newTranscriptomeDiv.appendChild(newTranscriptomeRowDiv4);
     65
     66          transcriptomeGroup.appendChild(newTranscriptomeDiv);
     67
     68          transcriptomeCounter++;
     69          // alert('Handler for adding transcriptome called: ' + transcriptomeCounter);
     70          return true;
     71      });
     72
    2873  });
     74
Note: See TracChangeset for help on using the changeset viewer.