Tags:
create new tag
, view all tags

URLPARAM should expand in formfields

I like to define a template-topic with a form which contains an URLPARAM. Every time I enter it within the formfield it disappear.

Test case

I guess the problem is the use of " and % in formfields. Test using $percnt failed.

-- AndreUlrich - 02 May 2004

Hmm, I guess this is an enhancement request. The current spec is to initialize topic text content with URLPARAM and to initialize form content with formfieldname=value parameters.

Do you need to set just part of a form field? Or is setting the whole form field sufficient?

Actually, to be consistent it would be better to implement URLPARAMs also for form fields smile

-- PeterThoeny - 04 May 2004

I've made a solution that works. I am curious if it is just so simple or that I am missing something.

In Edit.pm, handler edit, change

  $getValuesFromFormTopic = ( ( $formTemplate ) && ( ! $ptext ) );
to:
  $getValuesFromFormTopic = ( ( $formTemplate ) && ( ! $ptext ) ) || $templateTopic;

If the topic is created from a template, $getValuesFromFormTopic evaluates as true, so in Form.pm, handler renderForEdit, the value for the field is lifted from the url parameter.

If the topic is not created from a template, the old boolean comparison is used.

-- ArthurClemens - 16 Sep 2004

You don't need to use URLPARAM, you can just use the name of the field as a parameter in the URL. See TWikiForms#Including_Forms_in_New_Topics

-- SamHasler - 16 Sep 2004

Ok sorry, the field can be initialized by setting the parameter for it through formfieldname=value . Somehow I didnīt realized this as it seems to me more common to use URLPARAMs for it smile

I came across that fieldnames with "-" canīt get initialize (for example "Related-Dokuments")

-- AndreUlrich - 29 Dec 2004

 
Topic revision: r6 - 2006-01-03 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.