Changeset 570


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

Dynamic forms controls

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/simpleQuery/common/_query.gsp

    r555 r570  
    2626    </div>
    2727    <g:submitButton name="search" value="Search" /> <g:if test="${term}"><g:submitButton name="reset" value="Clear" /></g:if>
    28     </g:form>
    2928
    3029    <br><br>
     
    3332      <h3><a href="#">Simple Assays</a></h3>
    3433      <div class="element">
    35         <g:form action="pages" name="addCompound" id="addCompound">
    36         <div class="description">Compound (e.g. 'glucose')</div>
    37         <div class="input"><g:textField name="compound" value="" /></div>
    38         <div class="description">Value</div>
    39         <div class="input"><g:textField name="compound_value" value="" /></div>
    40         <g:submitButton id="addCompound" name="addCompound" value="Add compound" />
    41         </g:form>
     34        <div id="compoundGroup">
     35          <div id="compoundRow1">
     36            <div class="description">Compound (e.g. 'glucose')</div>
     37            <div class="input"><g:textField name="compound" value="" id="compound1" /></div>
     38            <div class="description">Value</div>
     39            <div class="input"><g:textField name="compound_value" value="" id="compoundValue1" /></div>
     40          </div>
     41        </div>
     42        <div id="addCompound">Add compound</div>
    4243      </div>
    4344
     
    4546
    4647      <div class="element">
    47         <g:form action="pages" name="addTransciptome" id="addTransciptome">
    48         <div class="description">List of Gene IDs or pathway IDs</div>
    49         <div class="input"><g:textField name="genepath" value="" /></div>
    50         <div class="description">Type of regulations</div>
    51         <div class="input"><g:select name="regulation" from="" value="${regulation}" noSelection="['':'--- select regulation ---']"/></div>
    52         <g:submitButton id="addTransciptome" name="addTransciptome" value="Add transciptome" />
    53         </g:form>
     48        <div id="transcriptomeGroup">
     49          <div id="transcriptomeRow1">
     50            <div class="description">List of Gene IDs or pathway IDs</div>
     51            <div class="input"><g:textField name="genepath" value="" /></div>
     52            <div class="description">Type of regulations</div>
     53            <div class="input"><g:select name="regulation" from="" value="${regulation}" noSelection="['':'--- select regulation ---']"/></div>
     54          </div>
     55        </div>
     56        <div id="addTranscriptome">Add transciptome</div>
    5457      </div>
    5558    </div>
     59    </g:form>
    5660
    5761    <br><br>
  • 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.