Item8357: Allow value field for hidden parameters

pencil
Priority: Enhancement
Current State: No Action Required
Released In:
Target Release:
Applies To: Extension
Component: RenderFormPlugin
Branches:
Reported By: MartinKaufmann
Waiting For:
Last Change By: MartinKaufmann
When creating HTML forms manually, I usually set a series of parameters to hidden but also add a value, e.g. to pre-set the date the topic was created or to set the task status to "open" (in a task management application). RenderFormPlugin allows to hide certain parameters but doesn't allow to defined values for these parameters (at least I haven't found a way of doing it). It would be nice to introduce this feature in RenderFormPlugin.

Example:
<input type="hidden" name="DateCreated" value="%GMTIME{$day $month $year}%" />
<input type="hidden" name="TaskStatus" value="open" />

-- MartinKaufmann - 03 Dec 2009

I found the solution myself and it's rather obvious: First, predefine the value of the date field in the form definition, e.g.
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |
| Date Created | date | 10 | %GMTIME{$day $month $year}% | When was this task created? | M |
In a second step, hide this field with the following call to RenderFormPlugin:
%RENDERFORM{"TestForm" templatetopic="TestTemplate" hidden="DateCreated" }%

-- MartinKaufmann - 27 Jan 2010

Careful: Item2228

-- PaulHarvey - 27 Jan 2010

Thanks for letting me know. So far, I haven't encountered any data loss. Could you described how this happened in your case? What do you mean by on update?

-- MartinKaufmann - 02 Feb 2010

IIRC, if you use RENDERFORM to render the form in edit mode from a view, it calls the submit button "update" (fields are populated with existing form data which may be modified and the user can submit ("update") their changes).

This avoids the view -> edit -> save-> cycle (becomes view->update->view)

-- PaulHarvey - 03 Feb 2010

SvenHess noted that submitting with GET method works, but using POST does not. See Tasks.Item2228

-- PaulHarvey - 03 Feb 2010

OK. I must have somehow (involuntarily) disabled this update mode. Might leave it this way. wink

-- MartinKaufmann - 04 Feb 2010
 

ItemTemplate edit

Summary Allow value field for hidden parameters
ReportedBy MartinKaufmann
Codebase 1.0.7
SVN Range
AppliesTo Extension
Component RenderFormPlugin
Priority Enhancement
CurrentState No Action Required
WaitingFor
Checkins
ReleasedIn
Topic revision: r7 - 18 Feb 2010, MartinKaufmann
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy