// Switch to Mata interpreter/compiler
mata:
// Drops class object if it already exists
// mata drop input()
// Definition of HTML Tag input Mata Class
// Defines an input control// Information retrieved from http://www.w3schools.com/tags/tag_input.asp
class input extends htmlglobal {
// Define private member variables
private:
// Static/final variables
static string scalar opens, opene, close
// String scalar attributes
string scalar htmlaccept, htmlalign, htmlalt, htmlautocomplete, htmlautofocus, htmlchecked, htmldisabled, htmlform, htmlformaction, htmlformenctype, htmlformmethod, htmlformnovalidate, htmlformtarget, htmlheight, htmllist, htmlmax, htmlmaxlength, htmlmin, htmlmultiple, htmlname, htmlpattern, htmlplaceholder, htmlreadonly, htmlrequired, htmlsize, htmlsrc, htmlstep, htmltype, htmlvalue, htmlwidth
// Make class args non-static to prevent assignment of class args to all instances of class
string scalar classargs
// Define public members/methods
public:
// Class constructor method
void new()
// Setter methods
class input scalar setClassArgs(), setAccept(), setAlign(), setAlt(), setAutocomplete(), setAutofocus(), setChecked(), setDisabled(), setForm(), setFormaction(), setFormenctype(), setFormmethod(), setFormnovalidate(), setFormtarget(), setHeight(), setList(), setMax(), setMaxlength(), setMin(), setMultiple(), setName(), setPattern(), setPlaceholder(), setReadonly(), setRequired(), setSize(), setSrc(), setStep(), setType(), setValue(), setWidth()
// Getter methods
string scalar getOpens(), getOpene(), getClose(), print(), getClassArgs(), getAccept(), getAlign(), getAlt(), getAutocomplete(), getAutofocus(), getChecked(), getDisabled(), getForm(), getFormaction(), getFormenctype(), getFormmethod(), getFormnovalidate(), getFormtarget(), getHeight(), getList(), getMax(), getMaxlength(), getMin(), getMultiple(), getName(), getPattern(), getPlaceholder(), getReadonly(), getRequired(), getSize(), getSrc(), getStep(), getType(), getValue(), getWidth()
} // End of class declaration
// Class constructor method declaration
void input::new() {
// Defines the start of the opening tag for the class
this.opens = " element should have autocomplete enabled
class input scalar input::setAutocomplete(| string scalar methodarg) {
// Validate argument
if (methodarg == "on" | methodarg == "off") {
// Set the attribute value
this.htmlautocomplete = `" autocomplete=""' + methodarg + `"""'
} // End IF Block for validated argument value
// Return a copy of the object
return(this)
} // End of Method autocomplete declaration for class input
// Specifies that an element should automatically get focus when the page loads
class input scalar input::setAutofocus(| string scalar methodarg) {
// Set the attribute autofocus for this class
this.htmlautofocus = `" autofocus=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method autofocus declaration for class input
// Specifies that an element should be pre-selected when the page loads (for type="checkbox" or type="radio")
class input scalar input::setChecked(| string scalar methodarg) {
// Set the attribute checked for this class
this.htmlchecked = `" checked=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method checked declaration for class input
// Specifies that an element should be disabled
class input scalar input::setDisabled(| string scalar methodarg) {
// Set the attribute disabled for this class
this.htmldisabled = `" disabled=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method disabled declaration for class input
// Specifies one or more forms the element belongs to
class input scalar input::setForm(| string scalar methodarg) {
// Set the attribute form for this class
this.htmlform = `" form=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method form declaration for class input
// Specifies the URL of the file that will process the input control when the form is submitted (for type="submit" and type="image")
class input scalar input::setFormaction(| string scalar methodarg) {
// Set the attribute formaction for this class
this.htmlformaction = `" formaction=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method formaction declaration for class input
// Specifies how the form-data should be encoded when submitting it to the server (for type="submit" and type="image")
class input scalar input::setFormenctype(| string scalar methodarg) {
// Validate argument
if (methodarg == "application/x-www-form-urlencoded" | methodarg == "multipart/form-data" | methodarg == "text/plain") {
// Set the attribute value
this.htmlformenctype = `" formenctype=""' + methodarg + `"""'
} // End IF Block for validated argument value
// Return a copy of the object
return(this)
} // End of Method formenctype declaration for class input
// Defines the HTTP method for sending data to the action URL (for type="submit" and type="image")
class input scalar input::setFormmethod(| string scalar methodarg) {
// Set the attribute formmethod for this class
this.htmlformmethod = `" formmethod=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method formmethod declaration for class input
// Defines that form elements should not be validated when submitted
class input scalar input::setFormnovalidate(| string scalar methodarg) {
// Set the attribute formnovalidate for this class
this.htmlformnovalidate = `" formnovalidate=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method formnovalidate declaration for class input
// Specifies where to display the response that is received after submitting the form (for type="submit" and type="image")
class input scalar input::setFormtarget(| string scalar methodarg) {
// Validate argument
if (methodarg == "_blank" | methodarg == "_self" | methodarg == "_parent" | methodarg == "_top" | methodarg == "framename") {
// Set the attribute value
this.htmlformtarget = `" formtarget=""' + methodarg + `"""'
} // End IF Block for validated argument value
// Return a copy of the object
return(this)
} // End of Method formtarget declaration for class input
// Specifies the height of an element (only for type="image")
class input scalar input::setHeight(| string scalar methodarg) {
// Set the attribute height for this class
this.htmlheight = `" height=""' + methodarg + `"""'
// Return a copy of the object
return(this)
} // End of Method height declaration for class input
// Refers to a