Hello,
With a big help from Bob đ , here is the code for a form dealing with a diving log book.
We use three tables jos_users, jos_comprofiler and jos_seminar (Seminar allows to handle events).
It's not the final release I have to add css and to finish what I call the loop (after each submit1, I reload the form until the end and I close with submit2)
Anyway I think it can help
With a big help from Bob đ , here is the code for a form dealing with a diving log book.
We use three tables jos_users, jos_comprofiler and jos_seminar (Seminar allows to handle events).
It's not the final release I have to add css and to finish what I call the loop (after each submit1, I reload the form until the end and I close with submit2)
Anyway I think it can help
<DIV class=form_item >
<DIV class="form_element cf_dropdown" ><LABEL class=cf_label >sélectionner un événement</LABEL>
<?php
$db =& JFactory::getDBO();
$query = "
SELECT id, title
FROM #__seminar WHERE NOW() > end ";
$db->setQuery($query);
$rows = $db->loadObjectList();
?>
<SELECT class="cf_inputbox validate-selection" id=select_3 size=3 name=select_3 >
<?php
foreach ( $rows as $row )
{
echo "<option value='".$row->id."' >".$row->title."</option>";
}
?>
</select>
</DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_dropdown" >
<LABEL class=cf_label >sélectionner un directeur de plongée</LABEL>
<?php
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM ".$db->nameQuote('#__users')." a
INNER JOIN ".$db->nameQuote('#__comprofiler')." b
ON ( a.id = b.id )
WHERE ( b.cb_niveauencadrement != '' )";
$db->setQuery($query);
$rows = $db->loadObjectList();
?>
<SELECT class="cf_inputbox validate-selection" id=select_4 size=3 name=select_4 >
<?php
foreach ($rows as $row)
{
echo "<option value='".$row->id."' >".$row->name."</option>";
}
?>
</select>
</DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_textbox" >
<LABEL class=cf_label >Palanquée n° :</LABEL>
<INPUT class="cf_inputbox required validate-digits" id=text_5 maxLength=2 size=2 name=text_5 >
<A class=tooltiplink onclick="return false;" ><IMG class=tooltipimg height=16 src="components/com_chronocontact/css/images/tooltip.png" width=16 border=0 ></A>
<DIV class=tooltipdiv >Palanquée n° : :: Numéro d'ordre de la palanquée</DIV>
</DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_dropdown" >
<LABEL class=cf_label >Sélectionner le guide :</LABEL>
<?php
$db =& JFactory::getDBO();
$query = "
SELECT *
FROM ".$db->nameQuote('#__users')." a
INNER JOIN ".$db->nameQuote('#__comprofiler')." b
ON ( a.id = b.id )
WHERE ( b.cb_niveauencadrement != '' )
OR ( b.cb_niveauplongeur = 'Niveau 4' )";
$db->setQuery($query);
$rows = $db->loadObjectList();
?>
<SELECT class="cf_inputbox validate-selection" id=select_5 size=3 name=select_5 >
<?php
foreach ($rows as $row)
{
echo "<option value='".$row->id."' >".$row->name."</option>";
}
?>
</select>
<A class=tooltiplink onclick="return false;" ><IMG class=tooltipimg height=16 src="components/com_chronocontact/css/images/tooltip.png" width=16 border=0 ></A>
<DIV class=tooltipdiv >Sélectionner le guide : :: Guide ou moniteur</DIV>
</DIV>
<DIV class=clear >Â </DIV></DIV>
<?php
$db =& JFactory::getDBO();
$query = "
SELECT id, name
FROM #__users ";
$db->setQuery($query);
$rows = $db->loadObjectList();
?>
<div class='form_item' >
<div class="form_element cf_dropdown" >
<label class='cf_label' >Sélectionner les plongeurs</label>
<select class="cf_inputbox validate-selection" id='select_6' multiple='multiple' size='4' name=select_6[] >
<?php
foreach ( $rows as $row )
{
echo "<option value='".$row->id."' >".$row->name."</option>";}
?>
</select>
<a class='tooltiplink' onclick="return false;" >
<img class='tooltipimg' height='16' src="components/com_chronocontact/css/images/tooltip.png" width='16' border='0' >
</a>
<div class='tooltipdiv' >Sélectionner les plongeurs :: Sélectionner au plus 4 plongeurs utilisez les touches <CTRL><C></div>
</div>
<div class='clear' >Â </div>
</div>
<DIV class=form_item >
<DIV class="form_element cf_textbox" ><LABEL class=cf_label >Heure de départ</LABEL><INPUT class="cf_inputbox required validate-date" id=text_8 maxLength=10 size=10 name=text_8 ></DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_textbox" ><LABEL class=cf_label >Heure de sortie</LABEL><INPUT class="cf_inputbox validate-date" id=text_9 maxLength=10 size=10 name=text_9 ></DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_textbox" ><LABEL class=cf_label >Palier Ă 3 m :</LABEL><INPUT class="cf_inputbox validate-number" id=text_10 maxLength=150 size=30 name=text_10 ><A class=tooltiplink onclick="return false;" ><IMG class=tooltipimg height=16 src="components/com_chronocontact/css/images/tooltip.png" width=16 border=0 ></A>
<DIV class=tooltipdiv >Palier à 3 m : :: saisir la durée du palier en mn</DIV></DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_textbox" ><LABEL class=cf_label >Palier Ă 6 m :</LABEL><INPUT class="cf_inputbox validate-number" id=text_11 maxLength=150 size=30 name=text_11 ><A class=tooltiplink onclick="return false;" ><IMG class=tooltipimg height=16 src="components/com_chronocontact/css/images/tooltip.png" width=16 border=0 ></A>
<DIV class=tooltipdiv >Palier à 6 m : :: Saisir la durée du palier à 6 m</DIV></DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_textarea" ><LABEL class=cf_label >Commentaires :</LABEL><TEXTAREA class=cf_inputbox id=text_12 name=text_12 rows=3 cols=30 ></TEXTAREA><A class=tooltiplink onclick="return false;" ><IMG class=tooltipimg height=16 src="components/com_chronocontact/css/images/tooltip.png" width=16 border=0 ></A>
<DIV class=tooltipdiv >Commentaires : :: Saisir ici vos commentaires, objet de la plongée, faits marquants</DIV></DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_button" ><INPUT type=submit value=Submit1 ></DIV>
<DIV class=clear >Â </DIV></DIV>
<DIV class=form_item >
<DIV class="form_element cf_button" ><INPUT type=submit value=Submit2 ></DIV>
<DIV class=clear >Â </DIV></DIV>