1 john Sep 23, 2006 11:15
3 yabba Sep 23, 2006 13:16
There's a few things in the forms class that break validation ;)
For the script, wrap it like this :-
<script type="text/javascript">
//<![CDATA[
......
......
//]]>
</script>
For the global icons etc change formstart to '<div>' and formend to '</div>' ;)
¥
4 john Sep 23, 2006 13:34
Thanks ¥åßßå
I'll put the original back and use your suggestions
5 yabba Sep 23, 2006 13:35
you'll also want to rearrange this section :-
$r .= $this->formend;
// Display all buffered hidden fields:
foreach( $this->hiddens as $hidden )
{
$r .= $hidden;
}
$r .= "\n</form>\n\n";
to :
// Display all buffered hidden fields:
foreach( $this->hiddens as $hidden )
{
$r .= $hidden;
}
$r .= $this->formend;
$r .= "\n</form>\n\n";
¥
6 john Sep 23, 2006 13:42
¥åßßå
re "formstart" and "formend"
Should I change every occurrence ... to <div> and </div> ???
case 'table':
$this->formstart = '<table cellspacing="0" class="fform">'."\n";
// Note: no thead in here until you can safely add a tbody to the rest of the content...
$this->title_fmt = '<tr class="formtitle"><th colspan="2"><div class="results_title">'
.'<span class="right_icons">$global_icons$</span>'
.'$title$</div></th></tr>'."\n";
$this->no_title_fmt = '<tr><th colspan="2"><span class="right_icons">$global_icons$</span></th></tr>'."\n";
$this->fieldstart = "<tr>\n";
$this->labelstart = '<td class="label">';
$this->labelend = "</td>\n";
$this->labelempty = '<td class="label"> </td>'."\n";
$this->inputstart = '<td class="input">';
$this->infostart = '<td class="info">';
$this->inputend = "</td>\n";
$this->fieldend = "</tr>\n\n";
$this->buttonsstart = '<tr class="buttons"><td colspan="2">';
$this->buttonsend = "</td></tr>\n";
$this->formend = "</table>\n";
break;
case 'fieldset':
$this->formstart = '';
$this->title_fmt = '<span style="float:right">$global_icons$</span><h2>$title$</h2>'."\n";
$this->no_title_fmt = '<span style="float:right">$global_icons$</span>'."\n";
$this->fieldstart = "<fieldset>\n";
$this->labelstart = '<div class="label">';
$this->labelend = "</div>\n";
$this->labelempty = '';
$this->inputstart = '<div class="input">';
$this->infostart = '<div class="info">';
$this->inputend = "</div>\n";
$this->fieldend = "</fieldset>\n\n";
$this->buttonsstart = '<fieldset><div class="input">';
$this->buttonsend = "</div></fieldset>\n\n";
$this->formend = '';
break;
case 'linespan':
$this->formstart = '';
$this->title_fmt = '$title$'."\n"; // TODO: icons
$this->no_title_fmt = ''; // "
$this->fieldstart = '<span class="line">';
$this->labelstart = '';
$this->labelend = "\n";
$this->labelempty = '';
$this->inputstart = '';
$this->infostart = '';
$this->inputend = "\n";
$this->fieldend = "</span>\n";
$this->buttonsstart = '';
$this->buttonsend = "\n";
$this->formend = '';
break;
case 'blockspan':
$this->formstart = '';
$this->title_fmt = '$title$'."\n"; // TODO: icons
$this->no_title_fmt = ''; // "
$this->fieldstart = '<span class="block">';
$this->labelstart = '';
$this->labelend = "\n";
$this->labelempty = '';
$this->inputstart = '';
$this->infostart = '';
$this->inputend = "\n";
$this->fieldend = '</span>'.get_icon( 'pixel' )."\n";
$this->buttonsstart = '';
$this->buttonsend = "\n";
$this->formend = '';
break;
default:
// "none" (no layout)
$this->formstart = '';
$this->title_fmt = '$title$'."\n"; // TODO: icons
$this->no_title_fmt = ''; // "
$this->fieldstart = '';
$this->labelstart = '';
$this->labelend = "\n";
$this->labelempty = '';
$this->inputstart = '';
$this->infostart = '';
$this->inputend = "\n";
$this->fieldend = "\n";
$this->buttonsstart = '';
$this->buttonsend = "\n";
$this->formend = '';
}
}
7 yabba Sep 23, 2006 13:49
You can if you like (just the "empty" ones), but I only change the fieldset one as that's the "default" on my blog. It certainly won't "harm" things if you do ;)
¥
8 john Sep 23, 2006 13:51
Thanks mate
9 yabba Sep 23, 2006 13:53
No problem ;)
¥
10 john Sep 23, 2006 13:59
Ok, now the only "strict validation" issue is
there is no attribute "name"
<form name="bComment_form_id_904" id="bComment_form_id_904" class="bComment" method="post" action="http://yoururl.com/htsrv/comment_post.php">
11 yabba Sep 23, 2006 14:02
ahhh, that's a skin thing, _feedback.php
$Form = & new Form( $htsrv_url.'comment_post.php' );
;)
¥
12 john Sep 23, 2006 14:40
Bingo :)
Your so good your dangerous ¥åßßå :)
I spent ages poking around everywhere else ...
13 blueyed Sep 23, 2006 17:08
¥åßßå wrote:
ahhh, that's a skin thing, _feedback.php
$Form = & new Form( $htsrv_url.'comment_post.php' );
;)
¥
Not so fast.. now the form has no ID anymore (which is required for JS for example). The problem is that the Form class adds both id and name attribs to the FORM tag, but that's fixed for 1.9 already. And if you want to fix it for 1.8, you're better off to fix it there, too.. :)
14 blueyed Sep 23, 2006 17:12
¥åßßå wrote:
you'll also want to rearrange this section :-
$r .= $this->formend; // Display all buffered hidden fields: foreach( $this->hiddens as $hidden ) { $r .= $hidden; } $r .= "\n</form>\n\n";
to :
// Display all buffered hidden fields: foreach( $this->hiddens as $hidden ) { $r .= $hidden; } $r .= $this->formend; $r .= "\n</form>\n\n";
¥
So that the HIDDEN INPUTS are in a container, right?
But it will probably fail for the "table" type form, because you'll then get the hidden inputs between the closing TR and the closing TABLE and that's probably invalid.
15 blueyed Sep 23, 2006 17:13
John, where have you seen $global_icon$?
@¥åßßå: I've just committed some CDATA fixes. Thanks.
16 yabba Sep 23, 2006 17:19
blueyed wrote:
So that the HIDDEN INPUTS are in a container, right?
But it will probably fail for the "table" type form, because you'll then get the hidden inputs between the closing TR and the closing TABLE and that's probably invalid.
Yep, and it would fail on the table type, so it would be better to just wrap them in their own div :-
$r .= '<div>';
// Display all buffered hidden fields:
foreach( $this->hiddens as $hidden )
{
$r .= $hidden;
}
$r .= '</div>';
¥
17 blueyed Sep 23, 2006 17:29
Shouldn't there be a global DIV then better inside of the Form?
Because e.g. with type "inline" the inline inputs would be invalid (not wrapped). OTOH a DIV (also only for the hiddens) could have layout issued, when the form is not supposed to be displayed as a block element.
18 john Sep 23, 2006 17:44
blueyed
It's not that I see it
It's that there is always the empty span error...
<span style="float:right"></span>
however it now validates with the div wraps
19 yabba Sep 23, 2006 17:51
personally I'd wrap the whole form (regardless of formstart & form end) as :-
<form ........>
<div>
.......
......
</div>
</form>
¥
20 blueyed Sep 23, 2006 20:25
John, the empty warning can be ignored and have nothing to do with the validator, but with tidy complaining about it - you're probably using the Firefox Validator plugin, I guess.
¥åßßå, yes that makes sense. I'll do it that way, but with an explicit "display:inline" in there.
21 john Sep 23, 2006 23:31
Thanks guys
22 blueyed Sep 23, 2006 23:37
Thanks for reporting.. ;)
23 john Sep 24, 2006 00:15
Ok, I restored everything , including the _feedback.php
Uploaded the new _form.class.php from the CVS and it validates fine.
@blueyed, yes, Tidy is only just lightweight "lint collector" when it comes to validation and often conflicts with W3C Validator. :)
24 john Sep 24, 2006 02:26
@blueyed
In the new CVS update for _form.class.php you have..
if( is_object($AdminUI) )
{ // Get default skin setting:
$template = $AdminUI->get_template( 'Form' );
This gives errors in the Admin screens which disappear when it's changed back to ...
if( is_object($AdminUI) )
{ // Get default skin setting:
$template = $AdminUI->get_menu_template( 'Form' );
I don't have a clue what it should be so I'm just bringing it to your attention
Cheers
John
25 blueyed Sep 24, 2006 20:42
John, you've downloaded the version from CVS HEAD, which will become 2.0 and this method has been renamed.
Try the Form class for version 1.9 instead: http://evocms.cvs.sourceforge.net/evocms/b2evolution/blogs/inc/_misc/_form.class.php?view=markup&pathrev=v-1-9
26 john Sep 25, 2006 00:00
Thanks for that blueyed.'
It's easy ( for me ) to get lost in the CVS :)
27 john Sep 25, 2006 07:47
@blueyed
Ummm... it's also the same in the 1.9 CVS
// Get default skin setting:
$template = $AdminUI->get_template( 'Form' );
$layout = $template['layout'];
28 blueyed Sep 25, 2006 19:42
Then you have to manually rename them locally in your _form.class.php.. :)
Well, I deleted it from _forms.class.php and the roof didn't fall in?
Another is the javascript.. where the two "&"'s should maybe be