dev-master
9999999-dev https://github.com/rbnvrw/markdown-formsClass to add, validate and mail simple HTML/AJAX forms via Markdown
MIT
The Requires
form markdown
Class to add, validate and mail simple HTML/AJAX forms via Markdown
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)
The basic syntax is as follows:, (*2)
?{type}("label" "value" "placeholder" rows*cols){.class}
<input>
element (required)id
for the <input>
element (optional)<input>
element (optional)<input>
element (optional)<textarea>
element, ignored for other types (required for <textarea>
)<input>
element (optional)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)
Class to add, validate and mail simple HTML/AJAX forms via Markdown
MIT
form markdown