Login   Register  
PHP Classes
elePHPant
Icontem

File: readme.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Carlos Falo Hervás  >  linked_select  >  readme.txt  >  Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: linked_select
Multiple dependent (linked) <select> tags
Author: By
Last change: setting roles
Date: 2002-07-26 09:51
Size: 3,253 bytes
 

Contents

Class file image Download
===== BASIC DOCUMENTATION FOR LINKED_SELECT CLASS =====

0.- INTRODUCTION AND EXTENTS

This tricky class was developed for a site requiring dynamic select content... I must tell
the general load for the page might be quite high depending on the data required from the
database operations.

It has been tested in all major 3 browsers (IE 5.x, NS4.x,NS5+) and generates the appropiate
code for each browser.

1.- BASICS OF OPERATION

Linked_select operation works creating a group of arrays with appropiate names and changing the
options collection (in DOM or DHTML model according to browser support)

This class requires classes:

	mysql_conn
	mysql_recordset

Both classes can be found in Database section under the name "mysql_db" in PHP Classes website
(see section 2)


PUBLIC INTERFACE:

  This class works in just 4 functions:

  linked_select($conn,$name,$tblname,$b0,$valuefld,$textfld,$selected=0,$subtblname,$s0,
		$subvalfld,$subtxtfld,$dependfld,$subselected=0,$debug=0)

    The constructor:

	$conn-> string for the name of a valid mysql_conn object
	$name-> basename for the linked_select items
	$tblname-> base table for primary select
	$b0->text displayed as 0 Element for primary select
	$valuefld-> field in $tblname for the value of the options in primary select
	$textfld-> field in $tblname for the text of the options in primary select
	$selected-> determines initial selected item in primary select
	$subtblname-> base table for secondary select
	$s0-> text displayed as 0 Element for secondary select
	$subvalfld-> field in $subtblname for the value on the options in secondary select
	$subtxtfld-> field in $subtblname for the text on the options in secondary select
	$dependfld-> dependent field in $subtblname that matches $valuefld in $tblname for linking
	$subselected-> determines initial selected item in secondary select NOT COHERENT, IF NOT FOUND NO SELECTION MADE (0 elem)
	$debug-> determines echo operations

  create_javascript()

    Generates the JavaScript interface for the select operations (creates it's own <script> tags)


  create_base_select()

    Creates primary select.  Must be called within a form

  create_sub_select()

    Creates secondary select. Must be called within a form

JAVASCRIPT PUBLIC INTERFACE:

  makeselect(frm,sel)

    frm-> form object (i.e. this.form or document.forms['frmname'])
    sel-> string with the name for the secondary select

    First eliminates all entries in secondary select and populates it based on primary select
    currently selected option

    Initially secondary select is populated form data according to primary select value
  
2.- Future releases and WIP

  This class is not finished, but is quite usable.  New releases will be posted at 
  http://phpclasses.upperdesign.com

  WIP on better browser detection, better select control operations, a 0-frame BASED version 
  and some extra crossbrowser details.

  Any suggestions are wellcome

3.- Contact information

  Carlos Falo Hervás
  carles@bisinteractive.net
  http://www.bisinteractive.net

  C/Manila 54-56 Esc. A Ent. 4ª
  08034 Barcelona Spain

  Phone: +34 9 3 2063652
  Fax:	 +34 9 3 2063689