Here what I did right now.
Form style:
| Code: |
<div align="left" style="width:100%" class="componentheading">{formtitle}</div>
<div style="text-align:left; margin: 0 auto;">
<form name="{formname}" id="{formname}" method="post" action="{action}" {enctype} onsubmit="return ValidateForm(fields);">
<legend>Please fill this form</legend>
<fieldset>
{formfields}
</fieldset>
</form>
</div>
|
Field style:
| Code: |
<div class="{fieldtype}">
<span class="label">
{fieldtitle}{validationsign}
</span >
<span class="field">
{field}
</span >
<span class="desc">
{fielddesc}
</span >
</div>
|
In html file, field are parsed like this:
| Code: |
case 'checkbox':
$html = str_replace('{fieldtitle}',"<label for=$row->name>$row->title</label>",$row->fieldstyle);
$html = str_replace('{fieldtype}','checkbox',$html);
$html = str_replace('{validationsign}',($row->validation_rule) ? ' *':'',$html);
$html = str_replace('{field}','<input type="checkbox" name="form['.$row->name.']" value="'.$row->default_value.'" id="'.$row->name.'" '.$row->params.' />',$html);
$html = str_replace('{fielddesc}', $row->description,$html);
break;
|
and I add a CSS (see attached file) this way in the showform function:
| Code: |
$html='<link href="'. $mosConfig_live_site .'/components/com_forme/forme.css" rel="stylesheet" type="text/css">';
if (!strpos($mainframe->getHead(), $html))
$mainframe->addCustomHeadTag($html);
|
Of course, it is not supposed to be the best way, only a draft...