"facebookesq" form functionality

joomla_tatsu 23 Nov, 2009
Hey Everyone,

Im building a registration site, and require two different types of registration. The first is individual registration with payment and the second is a team registration where only paid and registered members can be added to the team.

The first need is met by a simple form with the paypal plugin. (solved)

The second need is a little bit more complicated as it requires an option to select from a list of registered members compiled in the table of the first form when submitted.

(In less convoluted language) is it possible to have fields... perhaps a drop down box that are automatically populated from tabled data from other forms?

i.e. A, B, C, and D register for the event using Form 1. B wants to make a team for the event and wants to include C, D, and A. B goes to Form 2 to register the team for the event and selects A, C, and D from a list of '#' and hits submit.

My client is after a 'click to add' similar to the facebook invite functionality where a list of users can be seen and by selecting them from the list will add them to a group.

Ive looked at community solutions and event registration modules for Joomla but none meet my requirements and I have only limited knowledge of coding.

joomla_tatsu
GreyHead 23 Nov, 2009
Hi joomla-Tatsu,

Yes, you can build a drop-down box from the values stored in a table. The code will be something like this:
<?php
$db =& JFactory::getDBO();
$query = "
  SELECT `user_id`, `name`
    FROM `#__some_table` ;
";
$db->setQuery($query);
$options = $db->loadObjectList();
?>
<select multiple='multiple' ... >
  <option value=''>--?--</option>
<?php
foreach ($options as $option ) {
  echo "<option value='".$option->user_id."'>".$option->name."</option>";
}
?>
</select>
Your table and column names will be different; the select tag is incomplete, . . .

Bob
joomla_tatsu 23 Nov, 2009
Thanks Bob thats awsome.

I'll need a bit of time to go through the code and digest it, though I can see what your doing.

I will let you know how it goes.

Joomla_Tatsu
joomla_tatsu 16 Dec, 2009
Bob,

I managed to get the form to automatically populate the sections but I loose the drop down functionality.

Am I missing a tag?

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Alias</label>
  <?php
$db =& JFactory::getDBO();
$query = "
  SELECT `alias`, `name`
    FROM `individual_regi` ;
";
$db->setQuery($query);
$options = $db->loadObjectList();
?>
<select multiple='multiple' ... >
  <option value=''>-Select-</option>
<?php
foreach ($options as $option ) {
  echo "<option value='".$option->alias."'>".$option->name."</option>";
}
?>
</select>
    
  </div>


Joomla_Tatsu
GreyHead 16 Dec, 2009
Hi Joomla_tatsu,

Well, you need to replace my shorthand ... in here with the correct select tag attributes.
<select multiple='multiple' ... >

Bob
This topic is locked and no more replies can be posted.