2017 © Pedro Peláez
 

library markdown-forms

Class to add, validate and mail simple HTML/AJAX forms via Markdown

image

rbnvrw/markdown-forms

Class to add, validate and mail simple HTML/AJAX forms via Markdown

  • Monday, December 1, 2014
  • by rbnvrw
  • Repository
  • 1 Watchers
  • 9 Stars
  • 9 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

markdown-forms

Class to add, validate and mail simple HTML/AJAX forms via Markdown. This class extends Michelf Markdown. Currently, basic <input> and <textarea> elements are supported., (*1)

Syntax

The basic syntax is as follows:, (*2)

?{type}("label" "value" "placeholder" rows*cols){.class}
  • type: the type of the <input> element (required)
  • label: the label, this also gets converted to an id for the <input> element (optional)
  • value: the value of the <input> element (optional)
  • placeholder: the placeholder for the <input> element (optional)
  • rows*cols: number of rows and columns for the <textarea> element, ignored for other types (required for <textarea>)
  • class: the class of the <input> element (optional)

Example

For example, to create a Twitter Bootstrap form:, (*3)

<form role="form" markdown="1">
  ?{text}("Name" "" "Name..."){.form-control}
  ?{email}("Email" "" "Email..."){.form-control}
  ?{text}("Subject" "" "Subject..."){.form-control}
  ?{textarea}("Message" "" "Message..." 3*20){.form-control}
  ?{submit}("" "Send!"){.form-control}
</form>

This gives the following output:, (*4)

<form role="form">
    <div class="form-group">
        <label for="name">Name</label>
        <input name="name" id="name" placeholder="Name..." class="form-control" type="text">
    </div>
    <div class="form-group">
        <label for="email">Email</label>
        <input name="email" id="email" placeholder="Email..." class="form-control" type="email">
    </div>
    <div class="form-group">
        <label for="subject">Subject</label>
        <input name="subject" id="subject" placeholder="Subject..." class="form-control" type="text">
    </div>
    <div class="form-group">
        <label for="message">Message</label>
        <textarea name="message" id="message" placeholder="Message..." class="form-control" rows="3" cols="20"></textarea>
    </div>
    <div class="form-group">
        <input value="Send!" class="form-control" type="submit">
    </div>
</form>

The templates for <input> and <textarea> can be customised by passing them as arguments to the class., (*5)

The Versions

01/12 2014

dev-master

9999999-dev https://github.com/rbnvrw/markdown-forms

Class to add, validate and mail simple HTML/AJAX forms via Markdown

  Sources   Download

MIT

The Requires

 

form markdown