Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container-fluid">
  <form id="dataForm" action="">
    <table id="tblAppendGrid"></table>
    <button id="submit" type="button" class="btn btn-primary">Submit</button>
  </form>
  <hr/>
  <div id="success" class="alert alert-success d-none" role="alert">
    <i class="fas fa-check"></i> This form is valid!
  </div>
  <div id="error" class="alert alert-danger d-none" role="alert">
    <i class="fas fa-exclamation-triangle"></i> This form is not valid...
  </div>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                // Add custom Parsley validator
window.Parsley.addValidator("mindate", {
  validateString: function(value, year) {
    // Check the year
    var requiredYear = parseInt(year);
    var inputYear = parseInt(value.substring(0, 4));
    return inputYear >= requiredYear;
  },
  messages: {
    en: "Please input a date equal or greater than %s-01-01."
  }
});

// Initial Parsley library with custom CSS classes for Bootstrap 4
$("#dataForm").parsley({
  errorClass: "is-invalid",
  successClass: "is-valid",
  errorsWrapper: '<span class="invalid-feedback"></span>',
  errorTemplate: "<div></div>"
});

// Initialize AppendGrid
window.myAppendGrid = new AppendGrid({
  element: "tblAppendGrid",
  uiFramework: "bootstrap4",
  iconFramework: "fontawesome5",
  columns: [
    {
      name: "TextColumn",
      display: "Text (Required)",
      type: "text",
      ctrlAttr: { required: "required" }
    },
    {
      name: "IntColumn",
      display: "Int (1 ~ 99999)",
      type: "number",
      ctrlAttr: {
        required: "required",
        min: "1",
        max: "99999"
      }
    },
    {
      name: "DateColumn",
      display: "Date (>=2018-01-01)",
      type: "date",
      ctrlAttr: {
        required: "required",
        // Set the custom validator attribute on generated date input control
        "data-parsley-mindate": "2018"
      }
    }
  ],
  afterRowAppended: function(caller, parentIndex, addedRows) {
    // Refresh parsley validator when row appended
    $("#dataForm")
      .parsley()
      .refresh();
  },
  afterRowInserted: function(caller, parentIndex, addedRows) {
    // Refresh parsley validator when row inserted
    $("#dataForm")
      .parsley()
      .refresh();
  },
  afterRowRemoved(caller, rowIndex) {
    // Refresh parsley validator when row removed
    $("#dataForm")
      .parsley()
      .refresh();
  },
  // Add extra classes
  sectionClasses: {
    // Make a smaller table
    table: "table-sm",
    // Generate smaller controls
    control: "form-control-sm",
    // Generate smaller button group
    buttonGroup: "btn-group-sm"
  },
  // Add some records for demonstration
  initData: [
    {
      TextColumn: "",
      IntColumn: "",
      DateColumn: "2017-12-31"
    },
    {
      TextColumn: "ABC",
      IntColumn: "0",
      DateColumn: ""
    },
    {
      TextColumn: "",
      IntColumn: "123",
      DateColumn: "2019-05-01"
    }
  ]
});

// Add click handler for submit button
$("#submit").on("click", function() {
  // Hide alert message
  $(".alert").addClass("d-none");
  // Validate the form
  if (
    $("#dataForm")
      .parsley()
      .validate()
  ) {
    // Form is valid!
    $("#success").removeClass("d-none");
  } else {
    // Form invalid
    $("#error").removeClass("d-none");
  }
});

              
            
!
999px

Console