[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - Notes on the HTML-style DialogBox

Notes on the HTML-style DialogBox

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Notes on the HTML-style DialogBox

Postby MarkB » Mon Aug 03, 2009 7:31 am

These are a few notes on the HTML-style DialogBox in PocoScript if anyone is interested. Most of the info was gleaned by trial and error while building a couple of message wizards using Poco 4.5 running on Windows Vista.

Disclaimer: None of this comes from headquarters in Victoria. Everybody on earth is a better web designer than I am.



HTML DialogBox in Poco Version 4

Much of HTML 3.2 seems functional; possibly nothing introduced in HTML 4 is functional. Some CSS works, some doesn't. Some XHTML-style end tags show up in Poco-generated HTML messages, so that might be an option.

AVAILABLE HTML TAGS:
  • b
  • big
  • blockquote
  • body -- Tried: <body background='C:\Users\Mark\Pictures\image.jpg'> <body bgcolor='#D7DF01'>
  • br
  • caption
  • center
  • cite
  • code
  • <!-- Comment -->
  • dl, dt, dd
  • em
  • font -- Tried attributes face, color, size
  • form -- Appears to be optional in DialogBox, but HTML 3.2 specifies that <INPUT> must be inside <FORM> tags, so...
  • h1, h2, etc.
  • hr
  • html -- HTML 3.2: "It is not required and may safely be omitted" (http://htmlhelp.com/reference/wilbur/body/html.html).
  • i
  • img -- Local images display normally. Web images do not display?
    Yes: <img src='C:\Users\Mark\Pictures\image.jpg' width='192' height='300' border='0'>
    No: <img src='http://www.mts.net/~user/images/image.gif' border='0'>
  • input
  • li
  • &mdash; &nbsp;
  • ol, li
  • option
  • p
  • pre
  • radio
  • s
  • select, option (optiongroup is ignored)
  • small
  • strike
  • strong
  • sub
  • sup
  • table
  • textarea
  • tr
  • td
  • u
  • ul, li
  • var
UNAVAILABLE:
  • a -- Hyperlinks display normally but do not function.
  • acronym (Has no effect? HTML 4.)
  • dfn
  • embed
  • fieldset (HTML 4)
  • img -- Local images display normally. Web images do not display?
    Yes: <img src='C:\Users\Mark\Pictures\image.jpg' width='192' height='300' border='0'>
    No: <img src='http://www.mts.net/~user/images/image.gif' border='0'>
  • optiongroup (Has no effect. HTML 4.)
  • q (HTML 4)
  • title



GENERAL NOTES

Quotation marks around attributes appear to be optional in some cases.
type=radio name=$day but value='monday morning'

If the HTML code is in a PocoScript string literal, for example,
DialogBox "<p>Joe said, \"Hello.\"</p>"
then (a) quotation marks around attributes may as well be single rather than double and (b) double quotation marks within the HTML should be \"escaped,\" replaced with &quot; or some such.

<html></html> tags appear to be optional.

<body></body> tags appear to be optional.

<INPUT> is contained in block-level elements, and inline elements except BUTTON. HTML 3.2: INPUT "May occur in: BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DT, DD, LI, P, H1, H2, H3, H4, H5, H6, PRE, ADDRESS, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, FONT, A, APPLET, CAPTION, but must be inside a FORM" (http://htmlhelp.com/reference/wilbur/form/input.html).



============
Radio Button
============

<INPUT TYPE=radio NAME=string VALUE=string/number [CHECKED] [DISABLED]>

ATTRIBUTE SPECIFICATIONS

type='radio'
- Required.

name='<string>'
- Required.
- Examples: name='$day' name=$encrypt
- All radio buttons in a group of radio buttons have the same name.
- The string is the name of a PocoScript variable.
- After DialogBox executes, the variable contains the value of the
selected radio button. If none is selected, the variable is untouched:
if it had a value before DialogBox, the value is unchanged; if it was
undefined, it remains undefined (the info in this sentence is current
up to Poco v4.5.0.3910).

value='<string/number>'
- Required.
- Examples: value=Tuesday value='Albert Johnson'

checked
- Optional.
- Specifies that the radio button is initially selected.

disabled
- Optional.
- Disables the radio button.

NOTES

When it is certain that some radio button or other in a group will be selected (as when one of them is initially selected by the CHECKED attribute), declaring the variable beforehand with a Set command is optional; DialogBox will declare and define the variable. Otherwise, an explicit declaration is best practice in Poco 4.5. DialogBox does not touch radio and checkbox inputs that the user leaves unselected; undeclared variables remain undeclared, and referencing an undeclared variable provokes an "undeclared variable" error.

Code: Select all
Embed $html "END-EMBED"
<h2>Radio Button Demo</h2>
<form>
<input type='radio' name='$day' value='mon' checked> Monday<br>
<input type='radio' name='$day' value='tue'> Tuesday<br>
<input type='radio' name='$day' value='wed'> Wednesday<br>
<input type='radio' name='$day' value='thu' disabled> <span style='color:gray'>Thursday</span>
</form>
END-EMBED
Set $day ""
DialogBox $html
MessageBox $day


Code: Select all
Embed $html "END-EMBED"
<h2>Radio Button Demo (Numeric)</h2>
<form>
<p>User rating:</p>
<p align='center'>Poor <input type='radio' name='#rating' value='1'> <input type='radio' name='#rating' value='2'> <input type='radio' name='#rating' value='3'> <input type='radio' name='#rating' value='4'> <input type='radio' name='#rating' value='5'> Best
</p>
</form>
END-EMBED
Set #rating 0
DialogBox $html
MessageBox #rating




========
Checkbox
========

<INPUT TYPE=checkbox NAME=string VALUE=string/number [CHECKED] [DISABLED]>

ATTRIBUTE SPECIFICATIONS

type='checkbox'
- Required.

name='<string>'
- Required.
- Examples: name=$styled name='#n'
- The string is the name of a PocoScript variable.
- After DialogBox executes, the variable has the value of the checkbox if
the checkbox is checked. If the checkbox is not checked, the variable
is not touched: if it had a value before DialogBox, the value is
unchanged; if it was undefined, it remains undefined (the info in this
sentence is current up to Poco v4.5.0.3910).
- Therefore, declare all checkbox-name variables with Set commands
before DialogBox executes.

value='<string/number>'
- Required.
- Examples: value=styled value='9'
- If the checkbox is checked, this string or number is assigned to the
checkbox-name variable.

checked
- Optional.
- Specifies that the checkbox is initially selected.

disabled
- Optional.
- Disables the checkbox.

NOTES

Declare all checkbox-name variables with Set commands before DialogBox executes.

Code: Select all
Embed $html "END OF HTMLb"
<h2>Robotic Sandwich Maker</h2>
<form>
<p><input type='checkbox' name='$bac' value='B'> Bacon<br>
<input type='checkbox' name='$let' value='L'> Lettuce<br>
<input type='checkbox' name='$mayo' value='M'> Mayo<br>
<input type='checkbox' name='$cheese' value='C'> Cheese &nbsp;
(<input type='radio' name='$cheese_type' value='real' checked> Real &nbsp;
<input type='radio' name='$cheese_type' value='veg'> Veggy)
<br>
<input type='radio' name='$bread' value='white' checked> White &nbsp;
<input type='radio' name='$bread' value='whole'> 100% &nbsp;
<input type='radio' name='$bread' value='rye'> Rye
</p>
<p>Notes to our chef, Cal 9000:<br>
<textarea name='$note' rows='3' cols='40'></textarea></p>
</form>
END OF HTMLb
Set $bac ""
Set $let ""
Set $mayo ""
Set $cheese ""
Set $cheese_type ""
Set $bread ""
Set $note ""
DialogBox $html
Set $t ""
AddStrings $t $bac $let $mayo $cheese " on " $bread "\n\n" $note
MessageBox $t




==========
Text Input
==========

<INPUT TYPE=text NAME=string [VALUE=string] [SIZE=n] [MAXLENGTH=n] [DISABLED] [READONLY]>

ATTRIBUTE SPECIFICATIONS

type='text'
- Required.

name='<string>'
- Required, if the PocoScript references the variable.
- The string is the name of a PocoScript variable.
- After DialogBox executes, the variable contains the contents of the text
input box unless the input box is disabled, in which case the variable
is not touched: if it had a value before DialogBox, the value is
unchanged; if it was undefined, it remains undefined (the info in this
sentence is current up to Poco v4.5.0.3910).

value='<string>'
- Optional.
- Specifies the initial contents of the text box.

size='<number>'
- Optional.
- Suggested number of characters for text input, or the width in
characters of the text box.

maxlength='<number>'
- Optional.
- Maximum number of characters of input allowed.

disabled
- Optional.
- A disabled text input control is read-only, cannot receive focus, and is
skipped over in the tab sequence. The text colour is pale. The contents
of the text area are not assigned to the variable; an undeclared
variable remains undeclared.

readonly
- Optional.
- Prevents the user from editing in the text box. The contents of the text
box ARE assigned to the variable.

NOTES

DialogBox defines all variables for input types text and password, and for
textarea, even when the input is blank. Therefore, declaring these
variables beforehand is optional. The exception is the variable for a
disbled input control.

Code: Select all
Embed $html "END OF HTMLc"
<style type="text/css">
<!--
h2{
background-color: aqua;
margin: 3px 9px 3px 9px;
padding: 3px 5px 3px 5px;
text-align: center;
letter-spacing: 2;
}
-->
</style>
<h2>HTML DialogBox - Text Input</h2>
<p>User name: <input type='text' name='$username' size='10'></p>
<p>Password: <input type='password' name='$password' size='15'></p>
<p>Comment: <textarea name='$comment' rows=4 cols=40></textarea></p>
END OF HTMLc
DialogBox $html
Set $t ""
AddStrings $t $username "\n" $password "\n" $comment
MessageBox $t




========
Textarea
========

Textarea creates a control that allows multi-line text input.

<TEXTAREA NAME=string ROWS=n COLS=n [DISABLED] [READONLY]>[string]</TEXTAREA>

ATTRIBUTE SPECIFICATIONS

name='<string>'
- Required, if the PocoScript references the variable.
- The string is the name of a PocoScript variable.
- After DialogBox executes, the variable contains the text in the text
input area, unless the textarea is disabled.

rows='<number>'
- Required.
- Specifies the number of visible rows.

cols='<number>'
- Required
- Specifies the number of visible columns, that is, the visible width in
characters of the text area.

disabled
- Optional.
- A disabled textarea control is read-only, cannot receive focus, and is
skipped over in the tab sequence. The text colour is pale. The contents
of the text area are not assigned to the variable; an undeclared
variable remains undeclared (this info is current up to Poco
v4.5.0.3910).

readonly
- Optional.
- Prevents the user from editing in the text area. The contents ARE
assigned to the variable.

NOTES

Text between the <TEXTAREA>..</TEXTAREA> tags specifies the initial content
of the text box. The reset button will revert the contents to this initial
text.

DialogBox defines all variables for input types text and password, and for
textarea, even when the input is blank. Therefore, declaring these
variables beforehand is optional. The exception is the variable for a
disbled input control.


Code: Select all
DialogBox "<h2>TEXTAREA Demo</h2><p>User name: <input type='text' name='$username' size='10'></p><p>Password: <input type='password' name='$password' size='15'></p><p>Comment: <textarea name='$comment' rows=4 cols=40>Hello, world.</textarea></p>"
Set $t ""
AddStrings $t $username "\n" $password "\n" $comment
MessageBox $t




============
Reset Button
============

A button that resets the form to its initial values.

<INPUT TYPE=reset [NAME=string] [VALUE=string] [DISABLED]>

ATTRIBUTE SPECIFICATIONS

type='reset'
- Required.

name='<string>'
- Optional.

value='<string>'
- Optional.
- This string replaces the default text on the button.

disabled
- Optional.

Code: Select all
DialogBox "<h2>Reset Button Demo</h2><p>Change something, then hit Reset.</p><form><p>User name: <input type='text' name='$username' value='Quasimodo' size='10'></p><p>Password: <input type='password' name='$password' size='15'></p><p>Comment: <textarea name='$comment' rows=4 cols=40>Default text will re-appear after a reset.</textarea></p><hr><p><input type='reset'></p></form>"
Set $t ""
AddStrings $t $username "\n" $password "\n" $comment
MessageBox $t



======
Select
======

<SELECT NAME=string [MULTIPLE] [SIZE=n] [DISABLED]>...</SELECT>

ATTRIBUTE SPECIFICATIONS

name='<string>'
- Required.
- The string is the name of a PocoScript variable.

size='<number>'
- Optional.
- Specifies the number of visible options. Default is one.

disabled
- Optional.

multiple
- Optional.
- Allows user to select more than one option. Automatically adjusts size.
- Seems non-functional in DialogBox: displays properly, but returns only first selection?


Option defines a menu choice within a <select> menu.

<OPTION [VALUE=string] [SELECTED]>...</OPTION>

ATTRIBUTE SPECIFICATIONS

value='<string>'
- Optional.
- This is the value that is submitted to the select-name variable. In the
absence of a value attribute, the contents of the <option> tag are
submitted.

selected
- Optional.
- The choice initially selected.

disabled
- Optional. HTML 4.0; non-functional in DialogBox up to Poco v4.5.0.3910.

<OPTGROUP>

OPTGROUP is HTML 4.0; non-functional in DialogBox up to Poco v4.5.0.3910.

NOTES

Width expands to accommodate the widest menu item.

Code: Select all
Embed $html "END-EMBED"
<H1 ALIGN="center">Santa Letter Generator</H1>
<P ALIGN="center">Adapted from a tiny excerpt from CHICKENHEAD.COM<BR>
<a href="http://www.chickenhead.com/stuff/santa/index.asp">http://www.chickenhead.com/stuff/santa/index.asp</a><BR>(Sorry, hyperlinks don't work. Chickenhead, please think of this as free advertizing.)</P>
<HR>
<BR>

<BIG>

Dear <SELECT NAME="$select1">
<OPTION VALUE="null">......</OPTION>
<OPTION>Santa Claus</OPTION>
<OPTION>Saint Nicolas</OPTION>
<OPTION>Father Christmas</OPTION>
<OPTION>Pagan Troll</OPTION>
<OPTION>Obese Trespassing Altruist</OPTION>
<OPTION>Satan Claus - Devourer of Children's Souls</OPTION>
</SELECT>,

<BR><BR>

This year, I have been a very
<SELECT NAME="$select2">
<OPTION VALUE="null">......</OPTION>
<OPTION>good</OPTION>
<OPTION>bad</OPTION>
<OPTION>materialistic</OPTION>
<OPTION>passive aggressive</OPTION>
<OPTION>manipulative</OPTION>
<OPTION>Ritalin-addled</OPTION>
</SELECT>

little<BR><BR>
<SELECT NAME="$select3">
<OPTION VALUE="null">......</OPTION>
<OPTION>boy</OPTION>
<OPTION>girl</OPTION>
<OPTION>TV watcher</OPTION>
<OPTION>advertising tampon</OPTION>
</SELECT>.

I have <SELECT NAME="$select4">
<OPTION VALUE="null">......</OPTION>
<OPTION>not</OPTION>
<OPTION>sometimes</OPTION>
<OPTION>compulsively</OPTION>
</SELECT>

<SELECT NAME="$select5">
<OPTION VALUE="null">......</OPTION>
<OPTION>lied</OPTION>
<OPTION>cheated</OPTION>
<OPTION>embezzled</OPTION>
<OPTION>pillaged</OPTION>
<OPTION>murdered</OPTION>
</SELECT>,

and I have<BR><BR>
<SELECT NAME="$select6">
<OPTION VALUE="null">......</OPTION>
<OPTION>always</OPTION>
<OPTION>often</OPTION>
<OPTION>rarely</OPTION>
<OPTION>never</OPTION>
</SELECT>

helped my
<SELECT NAME="$select7">
<OPTION VALUE="null">......</OPTION>
<OPTION>mommy</OPTION>
<OPTION>daddy</OPTION>
<OPTION>grandma</OPTION>
<OPTION>grandpa</OPTION>
<OPTION>brother</OPTION>
<OPTION>sister</OPTION>
<OPTION>mommy's &quot;special friend&quot;</OPTION>
<OPTION>other daddy</OPTION>
</SELECT>

with their

<BR><BR>
[SNIP]
<BR><BR>

Anyway, I hope you like the
<SELECT NAME="$select26">
<OPTION VALUE="null">......</OPTION>
<OPTION>cookies</OPTION>
<OPTION>cake</OPTION>
<OPTION>pudding</OPTION>
<OPTION>Jell-O</OPTION>
<OPTION>meatloaf</OPTION>
<OPTION>cognac</OPTION>
<OPTION>eight-ball</OPTION>
</SELECT>
I left you.

<BR><BR>

<SELECT NAME="$select27">
<OPTION VALUE="null">......</OPTION>
<OPTION>Love</OPTION>
<OPTION>Sincerely</OPTION>
<OPTION>Yours</OPTION>
<OPTION>Breathlessly</OPTION>
</SELECT>,

<BR><BR>

<INPUT TYPE="text" NAME="$sender_name" MAXLENGTH="30" SIZE="20" VALUE="INSERT NAME HERE">

<BR><BR>
[SNIP]
<BR><BR>

</BIG>
END-EMBED

DialogBox $html
Set $t ""
AddStrings $t "Dear " $select1 ",\n\nThis year, I have been a very " $select2 "...\n\n" $sender_name
MessageBox $t


Code: Select all
Embed $html "END OF HTML"
<h2>Select Demo - 4 Visible Options</h2>
<p>
<select name='$province' size=4>
<option selected>Alberta</option>
<option>Saskatchewan</option>
<option>Manitoba</option>
<option>Ontario</option>
</select>
</p>
END OF HTML
DialogBox $html
MessageBox $province


----------------------------------------------------------------------------

Edit 2009-08-13: Added "VALUE=string" to Text Input section, top. Added FORM tags to Reset Button demo. Replaced some personal data. Added bullets. Added "replaced with &quot; or some such" to General Notes section.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 1 guest

cron