Tags:
create new tag
, view all tags

Feature Proposals » EDITFORMFIELD variable with textarea support

Summary

Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
MergedToCore PeterThoeny AcceptedByReleaseMeeting 2016-08-13   TWikibug:Item7754 KampalaRelease

Edit Form

TopicSummary:
CurrentState:
CommittedDeveloper:
ReasonForDecision:
DateOfCommitment:   Format: YYYY-MM-DD
ConcernRaisedBy:
BugTracking:
OutstandingIssues:
RelatedTopics:
InterestedParties:
ProposedFor:
TWikiContributors:
 

Motivation

The type="" parameter is designed for HTML input tags. A textarea is related, but not an input tag, hence not part of the current spec. The EDITFORMFIELD can be enhanced to support type="textarea". This came up in Support.SID-02240.

Description and Documentation

  • "fieldname" type="textarea" value="..." size="80x6" - multi line text area field, size denotes columns x rows.

Examples

Impact

WhatDoesItAffect: API, Vars

Implementation

Patch:

--- TWiki/Render.pm   (revision 30200)
+++ TWiki/Render.pm   (working copy)
@@ -1525,6 +1525,28 @@
         my $html = '</form>';
         return $html;
 
+    } elsif( $type =~ /^textarea$/ ) {
+        # special case, construct <textara></textarea> tags
+        my $html = "<textarea name=\"$formField\"";
+        my $needsClass = 1;
+        my $class = 'twikiTextarea';
+        foreach my $key ( keys %$params ) {
+            next if( $key =~ /^(_DEFAULT|_RAW|name|size|type|text|value)$/i );
+            $needsClass = 0 if( $key =~ /^class$/i );
+            $html .= " $key=\"" . $params->{$key} . '"';
+        }
+        my $size = $params->{size} || '';
+        if( $size =~ /^([0-9]+)x([0-9]+)$/ ) {
+            $html .= " cols=\"$1\" rows=\"$2\"";
+        } elsif( $size =~ /^([0-9]+)$/ ) {
+            $html .= " cols=\"$1\" rows=\"6\"";
+        }
+        if( $needsClass ) {
+            $html .= ' class="twikiTextarea"';
+        }
+        $html .= '>' . $value . '</textarea>';
+        return $html;
+
     } elsif( $type ) {
         # special case, construct an <input type="" /> tag
         my $html = "<input name=\"$formField\" type=\"$type\"";

-- Contributors: Peter Thoeny - 2016-08-14

Discussion

Accepted by KampalaReleaseMeeting2016x08x18

-- Peter Thoeny - 2016-08-18

This is now in SVN trunk and 6.0 branch. Docs updated at TWiki.VarEDITFORMFIELD and TWiki06x00.VarEDITFORMFIELD.

-- Peter Thoeny - 2016-08-31

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2016-08-31 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.