Und noch eine Empfehlung:
Es macht Sinn, das Template so anzupassen, dass die Felder jeweils noch die CSS-Klasse cm_alternativeforms haben. So kann man dann nämlich dafür übergreifend Styles definieren, die für alle so eingebundenen Formularfelder in allen Formularen gelten. Ohne diese Klasse müsste man jedesmal die IDs ins CSS mit aufnehmen, dürfte das nie vergessen, usw.
Hier mein angepasstes form_alternative.html5 Template:
PHP-Code:
<?php if (TL_MODE == 'BE'):
?><span class="tl_gray">### ALTERNATIVE <?php
if ($this->cm_alternativeType == 'cm_start'): ?>START<?php
elseif ($this->cm_alternativeType == 'cm_else'): ?>ELSE<?php
elseif ($this->cm_alternativeType == 'cm_stop'): ?>STOP<?php
endif; ?> ###</span>
<?php elseif (!$this->tableless):
// table
?>
<?php
if ($this->cm_alternativeType == 'cm_start'): ?>
<tr class="<?php echo $this->rowClass; ?>">
<td class="col_0 col_first"> </td>
<td class="col_1 col_last"><?php echo $this->generate(); ?></td>
</tr>
</table>
<div class="cm_alternativeforms" id="alternative_<?php echo $this->strName; ?>" style="display: <?php echo ($this->value==0)?'block':'none'; ?>">
<table cellspacing="0" cellpadding="0" summary="Form fields">
<tr style="display: none"><td colspan="2"> </td></tr>
<?php
elseif ($this->cm_alternativeType == 'cm_else'): ?>
<tr style="display: none"><td colspan="2"> </td></tr>
</table>
</div>
<div class="cm_alternativeforms" id="else_<?php echo $this->strName; ?>" style="display: <?php echo ($this->value==1)?'block':'none'; ?>">
<table cellspacing="0" cellpadding="0" summary="Form fields">
<tr style="display: none"><td colspan="2"> </td></tr>
<?php
elseif ($this->cm_alternativeType == 'cm_stop'): ?>
<tr style="display: none"><td colspan="2"> </td></tr>
</table>
</div>
<table cellspacing="0" cellpadding="0" summary="Form fields">
<tr style="display: none"><td colspan="2"> </td></tr>
<?php endif; ?>
<?php
else:
// tableless
if ($this->cm_alternativeType == 'cm_start'): ?>
<?php echo $this->generate(); ?><br>
<div class="cm_alternativeforms" id="alternative_<?php echo $this->strName; ?>"
style="display: <?php echo ($this->value==0?'block':'none')?>">
<?php
elseif ($this->cm_alternativeType == 'cm_else'): ?>
</div>
<div class="cm_alternativeforms" id="else_<?php echo $this->strName; ?>"
style="display: <?php echo ($this->value==1?'block':'none');?>">
<?php
elseif ($this->cm_alternativeType == 'cm_stop'): ?>
</div>
<?php
endif;
endif; ?>
Lesezeichen