Tags:
create new tag
, view all tags

Question

Maybe it's just a newbie question, but it's really driving me crazy.

I need to get the content of some formfields to create a new topic with its name based on them. Just like this:

Project Name:
 

I've tried with

%FORMFIELD{"ProjectName" topic="WEB.TOPIC" alttext="Field doesnt found"}%

but it always displays alternative text, so it doesn't seems to find that field.

What should I do? frown

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Forms

-- RaquelAlegre - 25 May 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

FORMFIELD refers to TWikiForms not to HTML forms.

If you want to construct one form field from another, the only option I know of is to use javascript. You could also have an intermediary creator page that can do the text manipulations and present a new form with the appropriate field.

-- JustinLove - 25 May 2007

I believe this should work. Here's a slight variation on your form demonstrating use of formfield to populate field:

Topic Name:
Project Name:
 

-- LynnwoodBrown - 25 May 2007

Thank you both smile I've tried using javascript and it worked. It's quite simple! I've included a javascript function

function canSubmit(inForm)

which is called from the "onSubmit" parameter in the HTML form. I've defined some variables to get the content from the fields:

var inputProjectName = inForm.ProjectName.value; ...

and the i've defined the action here, with the javascript code, better than with de action parameter from the HTML form. This way, I can mix the variables from javascript and twiki:

inForm.action="%SCRIPTURLPATH{edit}%/%BASEWEB%/"+inputProjectName + "%GMTIME{$mo$day$year$hour$min$sec}";

This function is called when pressing the "submit" button and redirects the user to the edit view of a new topic with a name like this

ProjectName05302007081843

-- RaquelAlegre - 30 May 2007

Related support topics on formfields: AttachURLDoesntWorkInFormField, BatchEditFormFieldValue, CanAFormFieldGetDataFromTheTopic, DateFieldPluginFormFieldIsEditable, DeepRecursionUsingFormfieldInForm, DisplayFormFieldinTopic, DisplayFormfieldBasedOnTopicName, DisplayTopicsBasedOnFormFieldSearch, EvalVariableInFormfield, FormFieldListPlugin, FormFieldValueInMailNotify, FormFieldValuesInsideTopic, FormFieldsInExternalLinks, FormFieldsNotCompletelyFilled, FormatDataFromFormFieldCheckboxType, FormfieldEmptyInFormattedSearch, FormfieldTextareaSearchNotTruncatedProperly, HiddenMandatoryFormFieldsNotHidden, HowToCreateTopicNameFromFormField, HowToEditFormFieldDataInBodyOfText, HowToEditFormfieldsWithoutEdit, HowToInitialiseFormFields, HowToMetaSearchMultipleFormFields, HowToSearchBasedonFormFieldContents, HowToSearchForFORMFIELD, HowToSearchForTopicNameInFormField, HowToSearchFormFields, HowToSearchFormFields2, HowToSortSearchByDateFormField, HowToUpdateFormFieldValuesWithSearches, HowToUseFormfieldInIFCondition, HowToUseParentFORMFIELDInINCLUDE, InternationalCharactersInFormFields, METAformfieldDisplayBroken, MultipleDateValueFormfield, PreventRenderingOfHtmlFormFields, ProbleminGettingFormField, RenderFormfieldsInText, SEARCHFailWithFormFieldAfterUpgradeTo01Sep2004, SearchBasedOnDateFormfield, SearchForFormfieldsWithVar, SearchFormatFormField, SearchOnTwoOrMoreFormFields, SearchResultOrderedByFormfield, StoreFormFieldMetaFromPlugin, TemplatesAndFORMFIELDS, UrlParamInFormField, UseAFormFieldDateToSortAList, UsingMetaParentWithFormFields, VarOrCalcInsideFormfieldInsideIf, VariableInFormField

-- PeterThoeny - 30 May 2007

 
Change status to:
Topic revision: r7 - 2007-05-30 - 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.