The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
|
Submission Pre-Parser - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16) +--- Thread: Submission Pre-Parser (/showthread.php?tid=2541) |
Submission Pre-Parser - wslover317 - Jul 26th, 2013 Hi, In form tools I am using the Submission Pre-Parser module with an API form. It states in the description if you need to split a single form field into multiple fields, this can be done. Can anyone give me an example of how this is done? IE, I am adding 1278|Toy 2 as a value in a drop down. I would like to separate via the | and store the id "1278" in an id field and "Toy 2" in a toy field. Thank you in advance, Bill RE: Submission Pre-Parser - Joe - Jul 26th, 2013 Hi Bill, Here is an example from our documentation on how to use the submission pre-parser: http://modules.formtools.org/submission_pre_parser/?page=combining_fields_example You can add your rules into the pre-parser and use the explode function: http://php.net/manual/en/function.explode.php Cheers, Joe RE: Submission Pre-Parser - wslover317 - Jul 26th, 2013 Hi, Thanks for the reply. I have seen the example but what I want to do is the exact opposite. If my value for frm_toys is 1278|Toy How would I split that based on the separator and post 1278 to id and Toy to Name Using the pre-parser? RE: Submission Pre-Parser - Joe - Jul 30th, 2013 You'll need to tinker around with this, but the code should be something like: if ((isset($_POST["frm_toys"]) && !empty($_POST["frm_toys"])) = explode("|", $frm_toys); $_POST["ID"] = $drop_down_field[0]; // ID field needs to be defined in Form Tools already $_POST["name"] = $drop_down_field[1]; // name field needs to be defined in Form Tools already Cheers, Joe RE: Submission Pre-Parser - wslover317 - Jul 30th, 2013 That should give me the start I needed. Thank you very much! RE: Submission Pre-Parser - Joe - Jul 30th, 2013 if ((isset($_POST["frm_toys"]) && !empty($_POST["frm_toys"])) = explode("|", $frm_toys); $_POST["ID"] = $frm_toys[0]; $_POST["name"] = $frm_toys[1]; $drop_down_field was just an example. Replaced it with the variable you were using. Cheers, Joe |