Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

9.4.5.3 Table Row TR

<tr>...</tr>

Valid only in a table, the TR table row tag defines a row of cells that are defined with <td> tags.

Example 9-49 <tr >... </tr > tag

  form$ = '<form>' 
  form$ = form$ + '<table border=2>'  
  form$ = form$ + '<tr><td>This is' 
  form$ = form$ + '<td>one row of' 
  form$ = form$ + '<td>cells in a table!' 
  form$ = form$ + '</tr>' 
  form$ = form$ + '</table>' 
  form$ = form$ + '</form>' 
  input dialogbox form$: data$ 
  end

TR Table Row Tag Attributes

Table 9-8 Table Row TR Tag Attributes
Attribute Function
align alignment of the text within the table cell (left, right, center)
valign alignment of the text within the table cell (top, middle, bottom)
bgcolor= colorname sets the background colour for the table row
bordercolor= colorname sets the border colour for the table row
bordercolorlight= colorname sets the border highlight colour for the table row
bordercolordark= colorname sets the border shadow colour for the table row

9.4.5.4 Table Data TD

<td>

Valid only in a table row tag, the TABLE DATA tag defines a table cell.

Example 9-50 <td > tag

  form$ = '<form>' 
  form$ = form$ + '<table border=2>'  
  form$ = form$ + '<tr><td>Table data...' 
  form$ = form$ + '<td>More table data....' 
  form$ = form$ + '<td>And more table data!' 
  form$ = form$ + '</tr>' 
  form$ = form$ + '</table>' 
  form$ = form$ + '</form>' 
  input dialogbox form$: data$ 
  end

Table Data TD Tag Attributes

Table 9-9 TABLE DATA TD Tag Attributes
Attribute Function
colspan= number the number of columns this cell occupies
rowspan= number the number of rows this cell occupies
nowrap prevents word wrap within the cell
align alignment of the text within the table cell (left, right, center)
valign alignment of the text within the table cell (top, middle, bottom)
bgcolor= colorname sets the background colour for the table cell
bordercolor= colorname sets the border colour for the table cell
bordercolorlight= colorname sets the border highlight colour for the table cell
bordercolordark= colorname sets the border shadow colour for the table cell

9.5 Inserting Variable Data into a Form

To insert string variable string data into a form:

Example 9-51 Inserting String Variable Data into a Form

  a$ = '1.000' 
  form$ = form$ + '<form>Enter Length in Meters:' + 
  '<input name=one size=10 type=text value=' + quote$(a$) + '></form>' 
   input dialogbox form$: ans$ 

To insert numeric variable data into a form:

Example 9-52 Inserting Numeric Variable Data into a Form

  cash_amt = 123.45 
  form$ = form$ + '<form>Enter Dollar Amount:' + 
  '<input name=one size=10 type=text value=' + quote$(str$(cash_amt)) + '></form>' 
  input dialogbox form$: ans$ 

9.6 Storing Selections from a Form into Variables

Values chosen from a dialogbox form drop-down menu can be stored into variables and used to be displayed later.

The way to do this is to regenerate the DIALOGBOX string with the default where it needs to be.

Example 9-53 Storing a select option into a variable for displaying later

  form_menu$ = '<form>' 
  form_menu$ = form_menu$ + 'Age: <select name=age>' 
  form_menu$ = form_menu$ + '<option value="_age_">_age_' 
  form_menu$ = form_menu$ + '<option value="21">21' 
  form_menu$ = form_menu$ + '<option value="22">22' 
  form_menu$ = form_menu$ + '<option value="23">23' 
  form_menu$ = form_menu$ + '</select>' 
  form_menu$ = form_menu$ + '</form>' 
 
  last_age$ = "23" 
  do
    default_age$ = last_age$ 
    default_form$ = replace$(form_menu$,'_age_='+default_age$) 
    input dialogbox default_form$: choice$ 
    if _exit then exit do
    for item = 1 to pieces(choice$, chr$(26)) 
      z0$ = piece$(choice$, item, chr$(26)) 
      varname$ = element$(z0$, 1, '=') 
      value$   = element$(z0$, 2, '=') 
      select case varname$ 
      case 'age' 
        last_age$ = value$ 
      case else
      end select
    next item 
  loop
  end

9.7 Performing Data Record Lookups and Updates

Below is an example of creating a dialogbox form where data records from a data structure are accessed and able to be updated.

Example 9-54 Storing a Select Option Into a Variable

// Simple customer query 
open structure cust: name 'sheerpower:\samples\customer', access outin
cust$ = '12513' 
set structure cust, field custnbr: key cust$  // do the search 
cname$   = cust(name) 
 
do
  
  dbox$ = '<form>' + 
          'Customer: <input type=text name=cnbr value=' + quote$(cust$) + '>' + 
          '<br>' + 
          'Name: <input type=text name=cname value=' + quote$(cname$) + '>' + 
          '<br>' + 
          '</form>' 
  input dialogbox dbox$: formdata$ 
  if _exit or _back then exit do
  if _help then repeat do
  
  z0$ = element$(formdata$, 1, chr$(26)) 
  cust$ = element$(z0$, 2, '=') 
  
  z0$ = element$(formdata$, 2, chr$(26)) 
  cname$ = element$(z0$, 2, '=') 
 
  set structure cust, field custnbr: key cust$  // do the search 
  if _extracted = 0 then
    message error: 'Cannot find '; cust$ 
    repeat do
  end if
  if cname$ = cust(name) then repeat do // nothing to do 
  cust(name) = cname$  // update the name 
loop
end

References used to gather information on HTML tags

http://www.htmlhelp.com

http://www.webspawner.com/cc/html/alpha.html

http://www.willcam.com/cmat/html/crossref.html

http://www.htmlgoodies.com


Previous Next Contents Index