Text Widget for HTML |
Services Products Contact us |
Karoo Project Docs Index |
|
|||
textHTMLA text can be constructed from an input element or a textarea element. These two elements really have most of the functionality you need, the widget library in this case just embellishes them and makes them conformant to the style of the other widgets. The widget library does add the "numeric" functionality whereby you can restrict the input to numeric only input. <input type="text" name="something" value="alphanumeric text"/> <!-- widget text action:myTextAction; --> ... or constrained to numeric only: <input type="text" name="something" value="123"/> <!-- widget text numeric action:myTextAction; --> ... or <textarea rows="3" cols="20" name="something">This is some text</textarea> <!-- widget text action:myTextAction; --> JavascriptThe "action:myTextAction" in the above examples causes a javascript function to be called when the enter key is pressed. The "action" property specifies the name of the function, in this case: "myTextAction" The function is called, and passed the HTML element where the text was entered. E.g. the following Javascript function is called when the examples on this page are entered:
function myTextAction(target)
{
alert("text entered "+elementToString(target)+"\nThe text value is '"+target.value+"'");
}
(The elementToString function is a convenience function supplied with the widget library for debugging purposes). CSSAt present the text widget does not use special CSS classes. However, future plans are to use more than just the input and textarea elements, and then there will be more CSS classes to consider. More... |
||||
|
Zwartberg Reseach & Development is a registered trading name of Open Source Software Consulting CC. |