The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Dublicate Form Entry - 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: Dublicate Form Entry (/showthread.php?tid=5112) |
Dublicate Form Entry - leob - Apr 2nd, 2015 Hello everyone, I'm building forms were I have a lot of similar Fields. Basically only the label varies. I already did some research and test programming. First thing I did was look at the mysql database and tried to figure out a solution here. To copy an entry of a form with all its properties four tables are involved (if I'm correct) form_fields table has most of the properties of a new form field here we add a new entry: Code: INSERT INTO `form_fields` (`field_id`, `form_id`, `field_name`, `field_test_value`, `field_size`, `field_type_id`, `is_system_field`, `data_type`, `field_title`, `col_name`, `list_order`, `is_new_sort_group`, `include_on_redirect`) VALUES form_NR table consists of all the submissions of a form. I'm not interested in them, but the colums are the same as the col_name row in form_fields. So a new column is added: Code: ALTER TABLE form_NR ADD new varchar(1) DEFAULT NULL; field_settings table holds information for option lists (which I want to use) Code: SELECT @id := `field_id` FROM `form_fields` WHERE `col_name` = new; field_validation table: here we do the same as for field_settings, just for the validation settings. This sql code works but its obviously not very comfortable and doesn't check for any errors that may occur in between. All the values have to be changed by hand. A better solution would be to use the Smarty commands provided by formtools and hook them in the admin_edit_form_fields_tab. I'm just not very familiar with how to use these (ft_commands). I think it could be quite easy to retrieve all the needed information in this tab and create a field copy from there. Could you just tell me the ruff order of commands to build and fill a new field? Maybe there is a cleverer solution for this? RE: Dublicate Form Entry - garof - Apr 2nd, 2015 Hi leob, I'm not sure I understand what you 'd like to achieve. Is it that you want to make clones of the same form that you can, then, modify (as much or as little as needed)? If so, the easiest way to do that may be to install and use the Form Backup extension (http://modules.formtools.org/form_backup/). BTW, the data of each form are stored in the table ft_form_X, where X is the number of the form (e.g., 1 if you have a single form), in case you may want to quicly erase all the data held in a form prior to modifying it. I hope that helps! (Apr 2nd, 2015, 4:35 AM)leob Wrote: Hello everyone, RE: Dublicate Form Entry - leob - Apr 7th, 2015 Hey garof, thank you for your answer. I'm trying to do something different. Me and some friends like to bet/tip on sports. Till now I had an excel document calculating the points everybody gets etc. The tips I had to collect via mail and fill them in manually. So now I'm building forms to collect the data. These forms consist of dropdown fields that are 'required'. Only the label or name of the field changes. (name of the game, home and away team) What I'm trying to do is to create a bunch of the same fields in a form, with the mentioned properties already selected. I know the programming I'm doing here probably cost me a lot more time compared to just building the forms by hand, but I like scripting and finding easy/elegant solutions. RE: Dublicate Form Entry - Malliana - Feb 20th, 2021 (Apr 7th, 2015, 12:33 AM)leob Wrote: Hey garof, You can play almost all the games in your running shoes but some of that can't be played in running shoes such as basketball. basketballshoesplus if you want to buy basketball shoes at affordable prices with all of the best qualities. |