Open Source & stuff 

Salix.gr

User login

sc_ajax_select_boxes reference

Public methods:

  • add_select_box, add_radio_box
    Syntax: add_select_box(db_table_name, key_field_name,
    description_field_name, order_field_name,
    selected_value, tag_name, tag_id, [extra_tag_attributes]
    , [extra_where], [select_prompt_text])

    Syntax: add_radio_box(db_table_name, key_field_name,
    description_field_name, order_field_name,
    selected_value, tag_name, tag_id, [extra_tag_attributes]
    , [extra_where], [select_prompt_text])

    Adds a select/radio box definition.
    Parameters:

    • db_table_name is the database table where select box options are stored.
    • key_field_name is the field which holds key values for select box options.
    • description_field_name is the field which holds description text for select box options.
    • order_field_name is the field you want to be used to order option list. If table is already indexed or you want options shown in the same order that are stored in db set order_field_name value to "".
    • selected_value is the initialy selected option, if set to '' then Please select... option will be selected.
      The SQL statement that is created to load options has the form:

      SELECT key_field_name, description_field_name
      FROM db_table_name
      [ORDER BY order_field_name]

      Caution: This value is not used when select box is linked using link_select_boxes method. Set selected value with link_select_boxes.

    • tag_name HTML name attribute for the select box. Also used by the class to reference select box definitions.
    • tag_id HTML id attribute for the select box.
    • [extra_tag_attributes] any formating attributes you might need, style,width etc.
    • [extra_where] Extra filtering. Simply extra_field=value
      The SQL statement that is created to load options if extra where is added has the form:

      SELECT key_field_name, description_field_name
      FROM db_table_name
      WHERE extra_where
      [ORDER BY order_field_name]

    • [select_prompt_text] Prompt text for select box replacing 'Please select'.

    The class does not open mysql connection by it self, it expects a connection that is all ready open.

  • link_select_boxes
    Syntax: link_select_boxes(parent_box_name, child_box_name,
    link_field_name, selected_value)

    Links two select boxes so when users selects a value on parent box, child box will load the appropriate values from the database.
    Child box can act as a parent for an other box, like in the example.
    If select box is a linked by an other box (see link_select_boxes) then a WHERE clause is added.

    SELECT key_field_name, description_field_name
    FROM db_table_name
    WHERE link_field_name=selected_value
    [ORDER BY order_field_name]

    selected_value is the initialy selected value, helpful for record editing. When user selects another option to parent select box the selected_value is changed to the new one and child options are reloaded.
    Caution: Selected value set with add_select_box is not used when select box is linked using link_select_boxes method. Set selected value with link_select_boxes method.

    And if extra_where parameter is used for that select box will be

    SELECT key_field_name, description_field_name
    FROM db_table_name
    WHERE link_field_name=selected_value
    AND extra_where
    [ORDER BY order_field_name]

  • place_jscripts
    Syntax: place_jscripts()

    Outputs all needed javascripts. You can place place_jscripts call to the right place where you want javascripts to be placed on your page.

  • show_select_box
    Syntax: show_select_box(box_name)

    Outputs html code for the box_name select box. Must make a call for each defined select box. The reason for that is
    that you can place them where you need in your layout.

Properties:

There are some properties that allow you to customize strings displayed.

  • select_prompt_key,select_prompt_text, select_add_prompt_row
    Controls prompt row in select boxes. Prompt row is the row that says "Please select'.

    • select_prompt_key is the value of the option element. Default value is 0.
    • select_prompt_text is the text of the option element. Default value is 'Please Select'.
    • select_add_prompt_row is a boolean that sets the addition of that row. By default is TRUE.
  • select_wait_text
    Sets the 'Please wait' string.
  • select_empty_text
    Sets the '(None)' string.
  • select_not_found_text
    Sets the '(Not found)' string.
  • xml_encoding
    XML requests encoding. Default value ISO-8859-1.
  • group_pre_group
    Groups are applied to radio buttons. It is placed before group. Default ''.
  • group_post_group
    Groups are applied to radio buttons. It is placed after group. Default ''.
  • group_pre_input
    Groups are applied to radio buttons. It is placed before input tag.
    Default ''.
  • group_post_input
    Groups are applied to radio buttons. It is placed after input tag.
    Default .
  • group_wrap_every
    Number of radio buttons per line. If set to zero no wrap.
    Default 0.
  • group_pre_wrap
    It is placed before group.
    Default ''.
  • group_post_wrap
    It is placed after group.
    Default .
  • Grouping example:
    Place radio group in a table, 2 radios per row

    $o->group_pre_group ='<table>';
    $o->group_post_group ='</table>';
    $o->group_pre_input ='<td>';
    $o->group_post_input ='</td>';
    $o->group_wrap_every = 2;
    $o->group_pre_wrap ='<tr>';
    $o->group_post_wrap ='</td>';

First of all, Happy new year

First of all, Happy new year to all.. Thanks for the information. These are some very useful informations. Some informations were completely unknown to me. With the help of this page now i can handle things more better. Thanks again..keep up the good work.


All Rights Reserved 2006-2010 Salix.gr | Hosting by e-emporio