SID-00504: HtmlFormsPlugin break list
| Status: |
Answered |
TWiki version: |
4.3.0 |
Perl version: |
5.10 |
| Category: |
HtmlFormsPlugin |
Server OS: |
Debian / Ubuntu Server 8.10 |
Last update: |
16 years ago |
Hi, I was testing this plugin, and it's a nice way to create small forms attached to queries, however the formatting of the query I wanted to use this for breaks.
Example:
- %TEXTVALUE{value="%FORMFIELD{"Something"}%" destinationaddress="TestTopic10.Something"}%
Results in:
</li> <li> Testing (ok) </li></ul>
</li> <li> <form method="post" action="http://intranet/bin/save/Sandbox/TestTopic10" enctype="multipart/form-data">
</li></ul>
<input type="text" name="Something" value="Some Value" size="8" id="idSomething" etc... /> </form>
and it should be:
</li> <li> <form method="post" action="http://intranet/bin/save/Sandbox/TestTopic10" enctype="multipart/form-data">
<input type="text" name="Something" value="Some Value" size="8" id="idSomething" etc... /> </form>
</li></ul>
The plugin inserts a line break after the
<form>
tag which breaks the
<li>
tag.
I've also Added a Date element to this plugin.
Add:
Under sub initPlugin:
TWiki::Func::registerTagHandler( 'TEXTDATE', \&_TEXTDATE );
and Then Add:
sub _TEXTDATE {
my($session, $params, $theTopic, $theWeb) = @_;
my $class = shift;
my $value = $params->{value} || '';
my $destinationaddress = $params->{destinationaddress};
my $web = $theWeb;
my $topic = $theTopic;
my $variable = $destinationaddress;
if ($destinationaddress =~ /^(.*)\.([^.]*)$/) {
$topic = $1;
$variable = $2;
}
($web, $topic) = TWiki::Func::normalizeWebTopicName($web, $topic);
my $method='POST';
my $action="%SCRIPTURL{save}%/$web/$topic";
my $element = CGI::textfield(
{ name => $variable,
id => 'id'.$variable,
size=> 8,
value => $value,
class => $class->can('cssClasses') ?
$class->cssClasses('twikiInputField', 'twikiEditFormDateField') :
'twikiInputField twikiEditFormDateField'});
my $ifFormat = $TWiki::cfg{JSCalendarContrib}{format} || '%e-%b-%y';
TWiki::Contrib::JSCalendarContrib::addHEAD( 'twiki' );
$element .= CGI::image_button(
-name => 'calendar',
-onclick =>
"return showCalendar('id$variable','$ifFormat')",
-src=> $TWiki::cfg{PubUrlPath} . '/' .
$TWiki::cfg{SystemWebName} .
'/JSCalendarContrib/img.gif',
-alt => 'Calendar',
-class => 'twikiButton twikiEditFormCalendarButton' );
return getForm($session, $element, $method, $action, $variable, "$theWeb.$theTopic");
}
Any help on how to avoid this line break from happening would be great, thanks
--
HugoDeLaCerda - 2009-08-26
Discussion and Answer
In the plugin code, add three leading spaces after each newline. This will create follow-up lines of a bullet.
--
PeterThoeny - 2009-08-26
Thanks Peter, adding one space was enough to avoid the break, now I'm fighting with calendar plugin, 'cause the bullet renders properly now, but the event in the calendar doesn't. but I guess it's the same direction. Thanks again.
--
HugoDeLaCerda - 2009-08-26
When you generate
CalendarPlugin events, make sure to format it properly. Use
SpreadSheetPlugin CALC in a
FormattedSearch to format the time into the proper format.
--
PeterThoeny - 2009-08-26
Got it, the problem was in CGI startform, it was adding a line break
under sub startform
was:
return qq/<form method="$method" $action enctype="$enctype"$other>\n/;
changed to:
return qq/<form method="$method" $action enctype="$enctype"$other>/;
It fixes line break problems both in bullets and calendar.
Now I can have topics with a date field, a main calendar page that searches these topics and displays them, and a (tooltip hidden) edit date field to change events if needed all neatly in one place.
Example:
%DBQUERY{"topicformdate =~ '.*'" format="$n * $percntCALC{$FORMATTIME($TIME($formfield(topicformdate)), $day $mon $year) - $FORMATTIME($TIME($formfield(topicformdate)), $day $mon $year)}$percnt <BR>[[$web.$topic][$formfield(topiceventtitle)]] $nop$percntTOOL$nopTIP{TEXT=\"<table width=300 border=0 cellspacing=2 cellpadding=2> <td><b>Some Information</b></td><td colspan=5> $formfield(someinformation)</td></tr> <tr><td><b>otherstuff</b></td><td colspan=5> $formfield(otherstuff)</td></tr></table>\" BORDERCOLOR=\"#5080FF\" TITLE=\"[[$web.$topic][$formfield(topiceventtitle)]]\" STICKY=\"true\" WIDTH=\"300\" ABOVE=\"true\"}$nop$percnt *info* $nop$percntTOOLTIP{END}$nop$percnt $percntTWISTY{showlink=\"Edit Date\" hidelink=\"Hide\"}$percnt $percntTEXTDATE{value=\"$formfield(topicformdate)\" destinationaddress=\"$web.$topic.topicformdate\"}$percnt $percntENDTWISTY$percnt"}%
Great for a dynamic and easy to change schedule of events
Thanks again.
--
HugoDeLaCerda - 2009-08-26
Cool! How about writing a
blog post, describing what your goal was, how you did it, with some screenshots?
--
PeterThoeny - 2009-08-26
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.