Advertisement
Guest User

Untitled

a guest
May 11th, 2014
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.58 KB | None | 0 0
  1. {% extends _layout %}
  2.  
  3. {% block head %}
  4. <script type="text/javascript">
  5.     $(function(){
  6.         $("#valFieldText").show();
  7.         $("#valFieldBool").hide();
  8.         $("#valFieldInt").hide();
  9.        
  10.         $("#inputVarType").change(function(){
  11.             var val = $("#inputVarType").val();
  12.            
  13.             if(val == 1)
  14.             {
  15.                 $("#valFieldText").show();
  16.                 $("#valFieldBool").hide();
  17.                 $("#valFieldInt").hide();
  18.             }
  19.             else if(val == 2)
  20.             {
  21.                 $("#valFieldText").hide();
  22.                 $("#valFieldBool").show();
  23.                 $("#valFieldInt").hide();
  24.             }
  25.             else if(val == 3)
  26.             {
  27.                 $("#valFieldText").hide();
  28.                 $("#valFieldBool").hide();
  29.                 $("#valFieldInt").show();
  30.             }
  31.         });
  32.     });
  33. </script>
  34. {% endblock %}
  35.  
  36. {% block content %}
  37. <div class="container">
  38.     <h1>Create Variable</h1>
  39.    
  40.     {% if success %}
  41.     <p class="bg-success"><strong>{{smessage}}</strong></p>
  42.     {% else %}
  43.     <form role="form" method="post" action="">
  44.         <div class="form-group {{error1}}" id="fgName">
  45.             <label class="control-label" for="inputUsername">Name</label>
  46.             <input type="text" class="form-control" id="inputName" name="inputName" placeholder="Variable Name" value="{{ set_value('inputName') }}">
  47.             {{ form_error('inputName') }}
  48.         </div>
  49.        
  50.         <div class="form-group {[error2}}">
  51.             <label class="control-label" for="inputVarType">Variable Type</label>
  52.             <select class="form-control" name="inputVarType" id="inputVarType">
  53.                 <option value="1" {{ set_select("inputVarType", "1", true) }}>Text</option>
  54.                 <option value="2" {{ set_select("inputVarType", "2") }}>Boolean</option>
  55.                 <option value="3" {{ set_select("inputVarType", "3") }}>Integer</option>
  56.             </select>
  57.         </div>
  58.        
  59.         <noscript>
  60.             <strong>WARNING</strong>: You seem to have javascript enabled, so below you see 3 fields.<br/>
  61.             One for text, one for bool and one for int. You only need to fill out one, depending on the value you chose above.<br/>
  62.             So, if you choose text, fill out "Value - Text", if you choose boolean then tick true or false and if you choose Integer, fill out "Value = Integer".<br/>
  63.         </noscript>
  64.         <div id="valFieldText">
  65.             <div class="form-group {{error3}}" id="fgValField1">
  66.                 <label class="control-label" for="inputValText">Value<noscript> - Text</noscript></label>
  67.                 <input type="text" class="form-control" id="inputValText" name="inputValText" placeholder="Variable Value" value="{{ set_value('inputValText') }}">
  68.                 {{ form_error('inputName') }}
  69.             </div>
  70.         </div>
  71.         <div id="valFieldBool">
  72.             <div class="form-group {{error3}}" id="fgValField2">
  73.                 <label class="control-label" for="inputValBool">Value<noscript> - Boolean</noscript></label><br/>
  74.                 <label>
  75.                     <input type="radio" name="inputValBool" id="inputValBool" value="true" checked>
  76.                     True
  77.                 </label>
  78.                 <label>
  79.                     <input type="radio" name="inputValBool" id="inputValBool" value="false">
  80.                     False
  81.                 </label>
  82.             </div>
  83.         </div>
  84.         <div id="valFieldInt">
  85.             <div class="form-group {{error3}}" id="fgValField3">
  86.                 <label class="control-label" for="inputValInt">Value<noscript> - Integer</noscript></label>
  87.                 <input type="text" class="form-control" id="inputValInt" name="inputValInt" placeholder="Variable Value" value="{{ set_value('inputValText') }}">
  88.                 {{ form_error('inputName') }}
  89.             </div>
  90.         </div>
  91.        
  92.         {% if public_allowed %}
  93.             <div class="form-group {{error4}}" id="fgValField2">
  94.                 <label class="checkbox-inline">
  95.                     <input type="checkbox" id="inlineCheckbox1" value="option1"> Is Public
  96.                 </label>
  97.             </div>
  98.         {% endif %}
  99.        
  100.         <button type="submit" class="btn btn-default">Add</button><br/>
  101.     </form>
  102.     {% endif %}
  103. </div>
  104.    
  105.    
  106. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement