ajaxCRUD.com

» a PHP class to Create, Read, Update, & Delete from a mysql database table using AJAX

   by loud canvas media

AjaxCRUD Class Documentation / Reference Material

<< Reference overview
<< Home

defineAllowableValues

define "allowable" values for a field.
void defineAllowableValues ( String fieldName, String[] validValues, [ onedit_textbox = FALSE ] )
These allowable fields will display in a dropdown of the values you specify. You can have the values for the dropdown be the same as the text or separate. Both examples are provided below.

In addition, you can use the third parameter (optional) to allow fields (after being inserted) to NOT have only the allowed values permissable. If set to TRUE then a regular textbox will appear when editing this field--allowing any values.

Details

Type function
Returns void

Parameters

fieldName
The database field name to define allowable values for
validValues
The allowed values for that field. Can be an array of strings (for value = text) or an array of arrays (where [0] = value and [1] = text)
(optional) onedit_textbox (default: false)
If set to true this value allows the field to not open a dropdown box on EDIT of the field. It will be a textbox allowing any input

Example

With id and value the same


    $valid_values   = array("DropdownValue 1", "Dropdown Value2");
    $tblDemo->defineAllowableValues("fldCertainFields", $valid_values);

With id and value different


    $valid_values = array( array(0 => "ddv1", 1 => "Dropdown Value 1"), 
               array(0 => "ddv2", 1 => "Dropdown Value2") );
    $tblDemo->defineAllowableValues("fldCertainFields", $valid_values);

See also

New, Edit

 

"wow. that`s all I can say. Wow. I wish I had found this .... years ago.."
~Jake

What is a business/commercial website?

A commercial website is one created for a business, for which purpose is generating revenue or cash flow of any type (and that isn't under a non-profit organization). So if you're selling a product, selling advertisement, selling a service, or just marketing a commercial business, your site is commercial. A company website is also commercial even if it doesn't sell anything, as it's purpose is to front a commercial company.
Close