|
Multi-line Text Input
| [Previous] [Main] [Next] |
|
| |
| The htmlInputTextArea class is used to define multi-line text input areas on a form. When rendered by a browser, such areas appear as boxes within a page and can optionally contain horizontal or vertical scroll bars.
| |
|
| |
| htmlInputTextArea objects are added to an htmlForm object using the << insertion operator or the Add() method. As with other form elements, htmlInputTextArea objects have a name parameter, that identifies the value when submitted to a server.
| |
|
| |
| Constructor parameters and methods allow you to specify the following optional values:
| |
|
|
| |
| Normally, text entered by the user is transmitted to the server exactly as typed, including line breaks where the Enter key is pressed. The Wrap() method sets how the browser wraps words on lines longer than the text area's column width, and controls how line breaks are interpreted and sent to the server. There are three options for the Wrap() method, defined by the WordWrapType enumeration which is declared in textarea.h.
| |
|
| |
| Disables word wrap. Text typed by the user is displayed exactly as typed. If the user inserts a line break, it is included as part of the value when the form is submitted. The user may need to scroll horizontally.
| |
| Enables word wrap, but line breaks are not included when the user submits the form. The user does not need to scroll horizontally.
| |
| Enables word wrap, including line breaks when the form is submitted. The user does not need to scroll horizontally.
| |
|
| |
|
| |
|
| |
| #include <stdio.h>
| |
| #include <stdlib.h>
| |
| #include <dcmicro/htmlpp/htmlpp.h>
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| htmlForm form( "/cgi-bin/action.exe" ) ;
| |
| form << "Multi-line text input example"
| |
| << htmlParagraph() ;
| |
|
| |
| // Add a control to the form for entering a product
| |
| // description, 5 rows tall by 30 columns wide.
| |
| htmlInputTextArea desc( "desc", 5, 30 ) ;
| |
|
| |
| // Enable word-wrap that won't include line
| |
| // breaks in result.
| |
| desc.Wrap( wrap_soft ) ;
| |
|
| |
| // Assign the string value to be displayed.
| |
| desc = "Enter your product description here." ;
| |
|
| |
| form << desc
| |
| << htmlParagraph()
| |
| << htmlInputSubmit() ;
| |
|
| |
| page << form ;
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| <FORM ACTION="/cgi-bin/action.exe" METHOD="POST">
| |
| Multi-line text input example<P></P>
| |
| <TEXTAREA NAME="desc" ROWS="5" COLS="30" WRAP="SOFT">Enter your product description here.</TEXTAREA>
| |
| <P></P>
| |
| <INPUT TYPE="SUBMIT"></FORM>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
