Hallo,
habe die Komponente CK Forms zum Erstellen von Formularen. Wenn ich nun ein Formular bzw. eine Frage im Formular habe, dann sind die Antwortmöglichkeiten nicht sauber Radiobutton unter Radiobutton angeordnet sondern von links nach rechts. Wenn rechts zu Ende ist mit Platz, dann gehts in der nächsten Zeile weiter. Somit kann es auch sein, dass ein Radiobutton zu einer Antwortmöglichkeit noch in der Zeile davor (rechts) steht. Das verwirrt und schaut zudem noch äußerst bescheuert aus!
Ich hab schon einiges versucht im Template und in ein paar anderen Dateien, aber ehrlich gesagt, hab ich keinen Plan (mehr) wo ich das regeln sollte mit dem Zeilenumbruch? Also ich möchte es so haben:
Radiobutton 1 TEXT1
Radiobutton 2 TEXT2
Radiobutton 3 TEXT3
Radiobutton 4 TEXT4
und nicht etwa z.B. so:
Radiobutton 1 TEXT1 Radiobutton 2 TEXT2 Radiobutton 3
TEXT3 Radiobutton 4 TEXT4
PHP-Code:
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
$nbFields=count($this->ckforms->fields );
?>
<table class="contentpaneopen<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
<tr>
<td class="contentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>"><?php echo $this->ckforms->title; ?> </td>
</tr>
</table>
<?php
$lastFieldsToValidate = "";
for ($i=0;$i < $nbFields; $i++)
{
$field = $this->ckforms->fields[$i];
if ($field->mandatory == "1" || $field->t_texttype == 'email' || $field->t_texttype == 'date' || $field->t_texttype == 'number' || $field->t_minchar != '') {
$lastFieldsToValidate = $field->name;
}
}
?>
<script type="text/javascript">
var JNC_jQuery = jQuery.noConflict();
JNC_jQuery(function() {
JNC_jQuery(".ckform_tooltip").tooltip({
track: true,
showURL: false,
fade: 250,
showBody: "##",
id: 'cktooltip'
});
// validate signup form on keyup and submit
JNC_jQuery("#ckform").validate({
rules: {
<?php
for ($i=0;$i < $nbFields; $i++)
{
$field = $this->ckforms->fields[$i];
if ($field->mandatory == "1" || $field->t_texttype == 'email' || $field->t_texttype == 'date'
|| $field->t_texttype == 'number' || $field->t_minchar != '') {
if ($field->typefield != "select") echo $field->name.":{";
if ($field->typefield == "select") echo '"'.$field->name.'[]":{';
if ($field->mandatory == "1") {
echo "required: true";
if ($field->t_texttype == 'email' || $field->t_texttype == 'date' || $field->t_texttype == 'number' || $field->t_minchar != '') echo ',';
echo "\n";
}
if ($field->t_minchar != '')
{
echo "minlength: ".$field->t_minchar;
if ($field->t_texttype == 'email' || $field->t_texttype == 'date' || $field->t_texttype == 'number') echo ',';
echo "\n";
}
if ($field->t_texttype == 'email') {
echo "email: true";
if ($field->t_texttype == 'date' || $field->t_texttype == 'number') echo ',';
echo "\n";
}
if ($field->t_texttype == 'date') {
echo "date: true";
if ($field->t_texttype == 'number') echo ',';
echo "\n";
}
if ($field->t_texttype == 'number') {
echo "number: true";
echo "\n";
}
echo "}";
if ($field->name != $lastFieldsToValidate) echo ',';
}
}
if ($this->ckforms->captcha == 1)
{
echo ',';
echo "ck_captcha_code:{required: true}";
}
?>
}
});
});
</script>
<table class="contentpaneopen<?php echo $this->params->get( 'pageclass_sfx' ); ?>" id="ckformcontainer">
<?php if (strcmp ( $this->ckforms->description , "" ) != 0) { ?>
<tr>
<td valign="top" colspan="2"><?php echo $this->ckforms->description; ?> </td>
</tr>
<?php } ?>
<?php
$mandatory = false;
$upload = false;
$custominfo = false;
for ($i=0;$i < $nbFields; $i++)
{
$field = $this->ckforms->fields[$i];
if ($field->mandatory == "1") $mandatory = true;
if ($field->typefield == "fileupload") $upload = true;
if ($field->custominfo != "") $custominfo = true;
}
if ($mandatory == true)
{
?>
<?php } ?>
<tr>
<td valign="top" colspan="2">
<form action="<?php echo $this->formLink; ?>" method="post" id="ckform" class="form-validate ckform"<?php if($upload == true) { ?> enctype="multipart/form-data"<?php } ?>>
<input name="id" id="id" type="hidden" value="<?php echo $this->ckforms->id; ?>" />
<?php if($upload == true) { ?>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $this->ckforms->maxfilesize; ?>"" />
<?php } ?>
<?php
for ($i=0;$i < $nbFields; $i++)
{
$field = $this->ckforms->fields[$i];
if ($field->typefield == "hidden")
{
?>
<input name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" type="hidden" value="<?php echo $field->t_initvalueH; ?>" />
<?php
}
}
?>
<table cellpadding="0" cellspacing="0" border="0" id="ckform" class="contentpane ckform">
<?php
for ($i=0;$i < $nbFields; $i++)
{
$field = $this->ckforms->fields[$i];
if ($field->typefield != "hidden" && $field->typefield != "button")
{
$colspan = "";
if (($field->typefield =='textarea' || $field->typefield =='radiobutton' || $field->typefield =='checkbox') && $field->custominfo != "")
{
$colspan_textarea = "";
} else if (($field->typefield =='textarea' || $field->typefield =='radiobutton' || $field->typefield =='checkbox') && $field->custominfo == "")
{
$colspan = " colspan='2'";
} else if ($field->typefield !='textarea' && $field->typefield !='radiobutton' && $field->typefield !='checkbox' && $field->custominfo == "")
{
$colspan = "";
}
?>
<tr class="fieldrow">
<td class="cklabel<?php if ($field->typefield !='textarea') {?> fieldrowseparator<?php } else { ?> paddingbottom5<?php } ?>"
<?php if ($field->typefield =='textarea') { echo $colspan; } ?>>
<label id="<?php echo $field->name."lbl"; ?>" for="<?php echo $field->name; ?>"> <?php echo $field->label; ?>
: </label>
<?php if ($field->typefield =='textarea') {?>
<?php if ($field->custominfo != "")
{?>
</td><td <?php if ($custominfo == true) {?> colspan="2"<?php }?>>
<img class="ckform_tooltip" src="<?php echo JURI::root(true).'/components/com_ckforms/'; ?>img/info.png" title="<?php echo $field->custominfo; ?>" />
<?php } ?>
</td></tr>
<tr>
<?php } else { ?>
</td>
<?php } ?>
<td <?php echo $colspan; ?> id="<?php echo $field->name; ?>_cnt" class="ckfieldtd fieldrowseparator">
<?php
switch ($field->typefield)
{
case 'text':
switch ($field->t_texttype)
{
case 'text':
?>
<input type="text" name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" value="<?php echo $field->t_initvalueT; ?>" class="inputbox ckrequired ckinputbox" maxlength="<?php echo $field->t_maxchar; ?>" />
<?php
break;
case 'password':
?>
<input type="password" name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" value="<?php echo $field->t_initvalueT; ?>" class="inputbox ckrequired ckinputbox" maxlength="<?php echo $field->t_maxchar; ?>" />
<?php
break;
case 'number':
?>
<input type="text" name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" value="<?php echo $field->t_initvalueT; ?>" class="inputbox ckrequired ckinputbox" maxlength="<?php echo $field->t_maxchar; ?>" />
<?php
break;
case 'email':
?>
<input type="text" name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" value="<?php echo $field->t_initvalueT; ?>" class="inputbox ckrequired ckinputbox" maxlength="<?php echo $field->t_maxchar; ?>" />
<?php
break;
case 'date':
?>
<script type="text/javascript"><!--
JNC_jQuery(function() {
JNC_jQuery("#<?php echo $field->name; ?>").datepicker(JNC_jQuery.extend({}, JNC_jQuery.datepicker.regional["fr"], {
dateFormat: "dd/mm/yy",
showOn: "both",
buttonImage: "<?php echo JURI::root(true).'/components/com_ckforms/' ?>img/calendar.gif",
buttonImageOnly: true
}));
});
// --></script>
<input type="text" name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" value="<?php echo $field->t_initvalueT; ?>" class="inputbox ckrequired" maxlength="10" />
<?php
break;
}
break;
case 'fileupload':
?>
<input class="ckinputbox" name="<?php echo $field->name; ?>" type="file" />
<?php
break;
case 'textarea':
if ($field->t_HTMLEditor == 1)
{
$editorDesc = JFactory::getEditor();
$editor_param['smilies'] = '0';
$editor_param['layer'] = '0';
echo $editorDesc->display($field->name, $field->t_initvalueTA, 535, 200, $field->t_columns, $field->t_rows,true,$editor_param);
} else {
?>
<textarea class="ckinputbox" name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" cols="<?php echo $field->t_columns; ?>" rows="<?php echo $field->t_rows; ?>" wrap="<?php echo $field->t_wrap; ?>"><?php echo $field->t_initvalueTA; ?></textarea>
<?php
}
break;
case 'checkbox':
?>
<input name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" type="checkbox" value="<?php echo $field->t_initvalueCB; ?>" <?php if ($field->t_checkedCB == '1') { ?> checked<?php } ?> />
<?php
break;
case 'radiobutton':
$opt = explode("[-]", $field->t_listHRB);
$k=count($opt);
for ($j=0; $j < $k; $j++)
{
$checked = "";
$val = explode("==", $opt[$j]);
$key = explode("||", $val[1]);
$ipos = strpos ($key[1],' [default]');
if ($ipos != false) {
$checked = "checked";
$key[1] = substr($key[1],0,$ipos);
}
?>
<input name="<?php echo $field->name; ?>" id="<?php echo $field->name; ?>" type="radio" value="<?php echo $key[0]; ?>" <?php echo $checked; ?> />
<?php echo $key[1]; ?>
<?php
} ?>
<?php
break;
case 'select':
?>
<select class="ckdate" name="<?php echo $field->name; ?>[]" id="<?php echo $field->name; ?>" size="<?php echo $field->t_heightS; ?>" <?php if ($field->t_multipleS == '1') { ?> multiple<?php } ?> >
<?php if ($field->t_multipleS != '1' && ($field->t_heightS == '' || $field->t_heightS <= 1)) { ?>
<option value=""></option>
<?php }
$opt = explode("[-]", $field->t_listHS);
$k=count($opt);
for ($j=0;$j < $k; $j++)
{
$checked = "";
$val = explode("==", $opt[$j]);
$key = explode("||", $val[1]);
$ipos = strpos ($key[1],' [default]');
if ($ipos != false) {
$checked = 'selected="selected"';
$key[1] = substr($key[1],0,$ipos);
}
?>
<option value="<?php echo $key[0]; ?>" <?php echo $checked; ?> ><?php echo $key[1]; ?></option>
<?php
}
?>
</select>
<?php
break;
}
if ($field->custominfo != "" && ($field->typefield =='radiobutton' || $field->typefield =='checkbox'))
{ ?>
<img class="ckform_tooltip" src="<?php echo JURI::root(true).'/components/com_ckforms/'; ?>img/info.png" title="<?php echo $field->custominfo; ?>" />
<?php } ?>
<label for="<?php echo $field->name; ?>" class="error">
<br/>
<?php if ($field->customerror == "")
{
echo JText::_( 'Bitte beantworten Sie diese Frage!' );
} else {
echo $field->customerror;
}
?>
</label>
</td>
<?php if ($field->custominfo != "" && $field->typefield !='textarea' && $field->typefield !='radiobutton' && $field->typefield !='checkbox')
{ ?>
<td><img class="ckform_tooltip" src="<?php echo JURI::root(true).'/components/com_ckforms/'; ?>img/info.png" title="<?php echo $field->custominfo; ?>" /></td>
<?php } ?>
</tr>
<?php
}
}
?>
<?php
if ($this->ckforms->captcha == 1)
{
?>
<tr>
<td colspan="<?php if ($custominfo == true){?>3<?php } else {?>2<?php }?>" align="center" height="40"><img src='index.php?option=com_ckforms&task=captcha' align="absmiddle">
<input type="text" id="ck_captcha_code" name="ck_captcha_code" />
</td>
</tr>
<?php } ?>
<tr>
<td colspan="<?php if ($custominfo == true){?>3<?php } else {?>2<?php }?>" align="center" height="40">
<?php
for ($i=0;$i < $nbFields; $i++)
{
$field = $this->ckforms->fields[$i];
if ($field->typefield == "button")
{
$jsbutton = "";
if ($field->t_typeBT == "submit") {
//$jsbutton = "onclick='submitCkForm();'";
?>
<input name="submit_bt" id="submit_bt" type="submit" value="<?php echo $field->label; ?>" <?php echo $jsbutton; ?> />
<?php
} else if ($field->t_typeBT == "reset") {
?>
<input name="reset_bt" id="reset_bt" type="reset" value="<?php echo $field->label; ?>" />
<?php
}?>
<?php
}
}
?>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>