Advertisement
Guest User

Untitled

a guest
Mar 25th, 2016
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <div class="ui center aligned container" style="margin-top: 90px">
  2.         <form class="ui fluid inverted segment form">
  3.  
  4.             <div class="ui stacked inverted segment">
  5.                 <div class="field">
  6.                     <div class="ui left icon input">
  7.                         <i class="user icon"></i>
  8.                         <input type="text" name="name" placeholder="Name">
  9.                     </div>
  10.                 </div>
  11.  
  12.                 <div class="field">
  13.                     <div class="ui left icon input">
  14.                         <i class="mail icon"></i>
  15.                         <input type="text" name="email" placeholder="Email">
  16.                     </div>
  17.                 </div>
  18.  
  19.                 <div class="field">
  20.                     <div class="ui left icon input">
  21.                         <i class="history icon"></i>
  22.                         <input type="text" name="expiry" placeholder="Expiry">
  23.                     </div>
  24.                 </div>
  25.  
  26.                 <div class="ui fluid floating dropdown labeled search icon button" name="host">
  27.                     <i class="caret down icon"></i>
  28.                     <span class="center aligned text">Choose Host</span>
  29.                     <div class="menu">
  30.                         <div class="item">host1</div>
  31.                         <div class="item">host2</div>
  32.                         <div class="item">host3</div>
  33.                         <div class="item">host4</div>
  34.                     </div>
  35.                 </div>
  36.  
  37.                 <div class="ui fluid large teal submit big button" style="margin-top: 50px">Submit</div>
  38.  
  39.             </div>
  40.  
  41.             <div class="ui error message"></div>
  42.             <div class="ui success message"></div>
  43.         </form>
  44.  
  45.     </div>
  46.  
  47.     <script>
  48.         $('.ui.dropdown').dropdown();
  49.  
  50.         var formValidationRules = {
  51.             fields: {
  52.                 name: {
  53.                     identifier  : 'name',
  54.                     rules: [
  55.                         {
  56.                             type   : 'empty',
  57.                             prompt : 'Please enter your name'
  58.                         }
  59.                     ]
  60.                 },
  61.  
  62.                 email: {
  63.                     identifier  : 'email',
  64.                     rules: [
  65.                         {
  66.                             type   : 'empty',
  67.                             prompt : 'Please enter your email'
  68.                         },
  69.                         {
  70.                             type   : 'email',
  71.                             prompt : 'Please enter a valid email'
  72.                         }
  73.                     ]
  74.                 },
  75.                 expiry: {
  76.                     identifier  : 'expiry',
  77.                     rules: [
  78.                         {
  79.                             type   : 'empty',
  80.                             prompt : 'Please enter expiry'
  81.                         },
  82.                         {
  83.                             type   : 'integer[1..24]',
  84.                             prompt : 'Expiry should be between 1 and 24'
  85.                         }
  86.                     ]
  87.                 }
  88.             }
  89.         };
  90.  
  91.         var formSettings = {
  92.             on: 'blur',
  93.             inline: true,
  94.             onSuccess : function() {
  95.                 alert("success");
  96.                 return true;
  97.             }
  98.         };
  99.  
  100.         $(document).ready(function() {
  101.               $('.ui.form').form(formValidationRules, formSettings);
  102.         });
  103.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement