The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
How to append counter in submission list instead of id - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: How to append counter in submission list instead of id (/showthread.php?tid=1246)



How to append counter in submission list instead of id - ferri - Apr 28th, 2011

Hi,
In the View Submissions, I would like to have an incremental counter in the table list (with heading: No.) instead of id number.
How do I implement this so that if a submission is deleted, the number will be updated automatically.

Thanks!



RE: How to append counter in submission list instead of id - crunchers - Apr 29th, 2011

There's no way to do it from within the control panel but I guess you could manually change the field name of the particular form from "ID" to "No." (access to phpMyAdmin or some similar program will help you accomplish this).

Why not just leave it as ID?

Also, if you're asking how to automatically update all submissions ID values whenever a form is deleted (presumably so they all increment by 1, starting from 1) , you'd need to make a composite of the primary key of the table under a new field whenever the table (of form) is created. It probably wouldn't work reliably since you'd need to account for any forms that aren't finalised; you're liable to run into concurrency issues if you were to do it this way.

The way I'd approach it is to create a new field called "No.", and then write a function to trigger whenever a submission is created/deleted that retrieves the number of entries that exist within that table where the corresponding "is_finalized" field equals "yes"; then re-index the "No." field accordingly.

It would require a core hack to FT (a PITA to manage when dealing with updates) but I believe there is a hooks module that may allow you to do this without needing you to mess around with the source files.

I'm still learning PHP/mySql but that's certainly how I'd approach it.




RE: How to append counter in submission list instead of id - Ben - Apr 30th, 2011

Hey Ferri,

Crunchers - you're totally right, you'd need the Hooks Manager module, and do the logic you suggested. I just wrote up the following tutorial on how to do it:
http://docs.formtools.org/tutorials/auto_increment/

Let me know if I'm not clear on any of it, or if it's not quite what you had in mind! Smile

- Ben