• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

New field (List box) while posting

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way I can add a new field (List box) to forum other then Subject and Message body. Please let me know in detail. This field will be static list box (from table).
It should be also available with message if member selects any.
[originally posted on jforum.net by vijay_kr]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically, it sounds like you want to add a new data field to the jforum_posts table. In general, to add a field, you need to:

Figure out if you can use or embed the info into the existing database format. E.g., do I need a new column in the table, or can I live with storing it with the body or other string field and then parsing it out.

Once you've decided on the permanent storage model, you will need to modify the matching "entity" package object (e.g. Post.java) to include a new get/set method for the new field.

If you opted for using an existing column, you can probably get by with just adding in the parsing code to deal with the get and set methods for the real and new field. E.g., if you're using the first line of the text field and the new field, make sure the DB text field gets updated correctly for all combinations of set and gets.

If you are using a new column, you will have to modify the Data Access Object interfaces that deal with populating the entity object (generally a single class). Then you will need to create a custom DataAccessDriver class that uses your modified DAO object. (Settable via the config files).

Now that you have the underlying persistent storage sorted out, you will need to modify the templates related to this so it displays and has input fields for the new item.

For any template that has a "form" related to it (e.g., a new post or editing a post), you will need to modify the matching Action class method. E.g. the PostAction editSave() and insertSave() methods.
[originally posted on jforum.net by monroe]
 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic