Tags:
create new tag
view all tags
Yesterday I gave a presentation to ACCU at Symantec in Mountain View, CA. I prepared the ContactDB application and created it during the presentation. Today I thought that it might help to expand on that by writing this blog post.

I am looking forward for your feedback.

-- Peter Thoeny - 2010-09-10

We have now an improved contact database, packaged as a TWiki application & ready to be used: ContactDbAddOn. Attached is a screenshot of the application homepage. There is now a filter row to search for entries. Useful if you have hundreds or thousands of entries.

screen-db1.png

-- Peter Thoeny - 2010-10-14

I will have a session on this topic tomorrow Saturday 11:15am at the Silicon Valley Code Camp, http://www.siliconvalley-codecamp.com/Sessions.aspx, room 4203. It is a free event for 3000 attendees, come and join us!

-- Peter Thoeny - 2011-10-08

when you say "Create page to create new records". Why is that? Could we use instead the form that is generated when we edit a page based on the Template ?

When we edit a page based on that template we are shown a nice form below the textbox of the content of the page. It seems to me that there should be a way to, instead of editing both: the content of the page, and the added form, just edit the form. No?

It

-- Daniel Ajoy - 2012-01-18

The actual page of the code-camp currently is: https://codecamp.pbworks.com/w/page/46626203/How%20to%20Create%20Web%20Apps%20in%20the%20Cloud%20Using%20TWiki%202011 . Though I was hoping for recorded video of the session.

-- Daniel Ajoy - 2012-01-18

It is certainly possible to create a page without a hand-crafted "create new records" page: Simply use the edit script and tell it to use the proper template, such as %SCRIPTURL{edit}%/%WEB%?topic=JimmyNeutron;templatetopic=ContactTemplate - this tells the edit script to create a topic called JimmyNeutron using template topic ContactTemplate. Nevertheless you lose convenience because you still need a form to specify the topic name. In some applications this is not needed, for example the TWikibug:WebHome bug tracker application uses topic names that are generated automatically. If you specify topic=ID-AUTOINC001 to the edit script, you will get consecutively numbered topics ID-001, ID-002, ID-003, etc.

-- Peter Thoeny - 2012-01-23

I'm looking forward for the second answer smile I want to reuse the page from creating new records for editing them. Is this possible?

-- Dirk Wilhelmy - 2012-04-10

Dirk, three options:

1. Use TWiki's edit feature to edit a form: Create a link that point to the edit script, telling it to edit only the form (not the page content). Example link: [[%SCRIPTURL{edit}%/%BASEWEB%/%BASETOPIC%?t=%SERVERTIME{$epoch}%;action=form][Edit contact]]

2. Create a ModifyContact page to modify an existing record: Copy content over from NewContact and modify as follows:

  • Add a new HTML form on top that shows a picklist of all existing contacts, name the select "contact". When you submit the form, the page will have a contact=JimmyNeutron parameter that will be used in the original form below.
  • In the HTML input fields, initialize the values based on the contact URL parameter. Example: <input type="text" name="JobTitle" value="%FORMFIELD{ "JobTitle" topic="%URLPARAM{ "contact" encode="entity" }%" }%" size="40" />
  • Change the topic name to a hidden field: <input type="hidden" name="topic" value="%URLPARAM{ "contact" encode="entity" }%" />
  • Disable the submit button in case the contact URL parameter is empty (consult Javascript docs). Condition: %IF{ " '%URLPARAM{ "contact" encode="entity" }%' = '' " then="..." else="..." }%

It is possible to combine the NewContact and ModifyContact into one page. Some conditional code is required using %IF{}%.

3. In-line editing: The most usable solution is to add the contact edit feature into the ContactHeader. The current header only shows a summary of the contact info in table format. It can be enhanced to toggle between view mode and edit mode, e.g. to change the content in-line. We have done that with the user profile pages; for inspiration study the Main.UserProfileHeader topic.

-- Peter Thoeny - 2012-04-10:

From TWiki-6.0 on it is easier to create custom forms to add or update records. You can use VarEDITFORMFIELD instead of hand-crafted HTML input fields. The input type is automatically taken care of based on the type defined in the TWiki form.

Example form to add a new record:

  %EDITFORMFIELD{ "form" type="start" action="save" method="post" }%
  | Title:    | %EDITFORMFIELD{ "Title"    form="ActionItemForm" }% |
  | Priority: | %EDITFORMFIELD{ "Priority" form="ActionItemForm" }% |
  | Status:   | %EDITFORMFIELD{ "Status"   form="ActionItemForm" }% |
  |  | %<nop>EDITFORMFIELD{ "form" type="submit" value="Add Action Item" }% |
  %EDITFORMFIELD{ "Updated" type="hidden" value="%SERVERTIME{$year-$mo-$day}%" }%
  %EDITFORMFIELD{ "topic" type="hidden" value="AID-AUTOINC0001" }%
  %EDITFORMFIELD{ "topicparent" type="hidden" value="ActionItems" }%
  %EDITFORMFIELD{ "templatetopic" type="hidden" value="ActionItemTemplate" }%
  %EDITFORMFIELD{ "onlynewtopic" type="hidden" value="on" }%
  %EDITFORMFIELD{ "onlywikiname" type="hidden" value="on" }%
  %EDITFORMFIELD{ "form" type="end" }%

Example to update an existing record: Custom form in an included header to update some values of the base topic

  %EDITFORMFIELD{ "form" type="start" action="save" topic="%BASETOPIC%" method="post" }%
  | Title:    | %EDITFORMFIELD{ "Title"    topic="%BASETOPIC%" }% |
  | Priority: | %EDITFORMFIELD{ "Priority" topic="%BASETOPIC%" }% |
  | Status:   | %EDITFORMFIELD{ "Status"   topic="%BASETOPIC%" }% |
  |  | %<nop>EDITFORMFIELD{ "form" type="submit" value="Update Action Item" }% |
  %EDITFORMFIELD{ "Updated" type="hidden" value="%SERVERTIME{$year-$mo-$day}%" }%
  %EDITFORMFIELD{ "form" type="end" }%

-- Peter Thoeny - 2013-10-09

It is useful to have both in the included header: Show the form content, and also a form to change the form content. Example:

Form Content

(Add table with %FORMFIELD{}% variables to show form content)

Edit Form

(Add table with %EDITFORMFIELD{}% variables to edit form content)

This can be done with the JQTABPANE of the JQueryPlugin. Raw text:

%JQTABPANE%
%JQTAB{"Form Content"}%
(Add table with %FORMFIELD{}% variables to show form content)
%JQENDTAB%
%JQTAB{"Edit Form"}%
(Add table with %EDITFORMFIELD{}% variables to edit form content)
%JQENDTAB%
%JQENDTABPANE%

-- Peter Thoeny - 2013-10-22

At the SandboxWeb we build an example of a 'Library Application' to test the use of TWikiForms. See: LibraryApplicationBaseTopic and Support.SID-02319. This might be helpfull to others.

-- Emiel Van Riel - 2017-07-17

Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r12 - 2017-07-17 - EmielVanRiel
 

Twitter Facebook Digg Google Bookmarks E-mail LinkedIn Reddit    
  • Help
  • 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.