The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Custom Filed not displayed - 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: Custom Filed not displayed (/showthread.php?tid=2960) Pages:
1
2
|
Custom Filed not displayed - marco.pastore@geophi.it - Mar 19th, 2014 Hi All, I am using the Custom Filed module to generate a unique "document code" in our document database. The field lenght is about 20 chars. When i fill the form fields and then update the view the document code is calculated, but the problem is that it is not displayed into the view. This is really strange, because in the same form other 2 fields (shorter in lenght) are correctly calculated and displayed in this view. But, when i go to the forms item list the document code is correctly displayed in this view. I really need this code to be displayed in the document, what can i do ? Thanks for helping me, Marco Pastore RE: Custom Filed not displayed - Joe - Mar 20th, 2014 Hey Marco, Can you post the code please? Cheers, Joe RE: Custom Filed not displayed - marco.pastore@geophi.it - Mar 25th, 2014 Hi Joe, thanks for your answer ! This is the code (in the saving tab of the custom field module) that generates my document-code: $tmp_doc_prj_id = $vars['data']['doc_prj_name']; // Nome E Codice Progetto Da ricavare via query al DB progetti $query = mysql_query("SELECT prj_code FROM ft_form_15 WHERE submission_id = $tmp_doc_prj_id AND is_finalized = 'yes'"); $results = mysql_fetch_array($query); $tmp_prj_code = $results[0]; $query = mysql_query("SELECT prj_name FROM ft_form_15 WHERE submission_id = $tmp_doc_prj_id AND is_finalized = 'yes'"); $results = mysql_fetch_array($query); $tmp_prj_name = $results[0]; // Numero Documento da ricavare via query usando prj_id e doc_type $tmp_doc_type = $vars['data']['doc_doc_type']; $tmp_doc_colum = prj_.$tmp_doc_type._nr; $query = mysql_query("SELECT $tmp_doc_colum FROM ft_form_15 WHERE submission_id = $tmp_doc_prj_id AND is_finalized = 'yes'"); $results = mysql_fetch_array($query); $tmp_doc_code = $tmp_doc_type.str_pad($results[0] + 1, 2, "0", STR_PAD_LEFT); // Mittente e destinatario da ricavare via query al DB progetti $tmp_doc_mitt_id = $vars['data']['doc_doc_mittente']; $tmp_doc_dest_id = $vars['data']['doc_doc_dest']; $query = mysql_query("SELECT cont_code FROM ft_form_16 WHERE submission_id = $tmp_doc_mitt_id AND is_finalized = 'yes'"); $results = mysql_fetch_array($query); $tmp_doc_mitt_name = $results[0]; $query = mysql_query("SELECT cont_code FROM ft_form_16 WHERE submission_id = $tmp_doc_dest_id AND is_finalized = 'yes'"); $results = mysql_fetch_array($query); $tmp_doc_dest_name = $results[0]; $value = $tmp_prj_code.$tmp_prj_name."-".$tmp_doc_mitt_name."-".$tmp_doc_dest_name."-".$tmp_doc_code; And this is an example of resulting document-code displayed in the form-view but not in the Edit Submission page of the same record: 14026LSD14-GEOPH-ISMBO-CT01 Thanks for your help ! Marco RE: Custom Filed not displayed - marco.pastore@geophi.it - Mar 27th, 2014 No suggestions ?? Heeeelp !! Marco RE: Custom Filed not displayed - marco.pastore@geophi.it - Apr 1st, 2014 Hi All...nobody can help me ??? Marco RE: Custom Filed not displayed - Joe - Apr 1st, 2014 Marco, Thanks for the wait. We need to create a similar set up on our end with the custom field to give it a test. I suspect the issue with your code is that you are trying to set a variable column name ($tmp_doc_colum). Depending on your server setup, you might need single quotes around the variable name. For this code: $tmp_doc_type = $vars['data']['doc_doc_type']; $tmp_doc_colum = prj_.$tmp_doc_type._nr; $query = mysql_query("SELECT $tmp_doc_colum FROM ft_form_15 WHERE submission_id = $tmp_doc_prj_id AND is_finalized = 'yes'"); Try enclosing the variable with a backtick: $tmp_doc_type = $vars['data']['doc_doc_type']; $tmp_doc_colum = prj_.$tmp_doc_type._nr; $query = mysql_query("SELECT `$tmp_doc_colum` FROM ft_form_15 WHERE submission_id = $tmp_doc_prj_id AND is_finalized = 'yes'"); Or you can try to break out the variable $query = mysql_query("SELECT " . $tmp_doc_colum " FROM ft_form_15 WHERE submission_id = $tmp_doc_prj_id AND is_finalized = 'yes'"); Or $query = mysql_query("SELECT `" . $tmp_doc_colum "` FROM ft_form_15 WHERE submission_id = $tmp_doc_prj_id AND is_finalized = 'yes'"); I would output the query to ensure you are actually getting the correct SQL query otherwise you really don't know if you're actually pulling data and producing the code you need. There can be a SQL error and you wouldn't even know it. Cheers, Joe RE: Custom Filed not displayed - marco.pastore@geophi.it - Apr 3rd, 2014 Hi Joe, thanks for your answer. I tried to change the code, but the issue remains. As i can see, the document code is correctly computed and put into the database field, but the visualization of it in the Edit Submission page does not work. I would like to send you a screenshot..is it possible in this forum ? Cheers, Marco RE: Custom Filed not displayed - kaamil20 - Apr 4th, 2014 You should to post the code on it to display. RE: Custom Filed not displayed - marco.pastore@geophi.it - Apr 22nd, 2014 No suggestions for me ?? Heeellllpppp RE: Custom Filed not displayed - marco.pastore@geophi.it - Apr 23rd, 2014 RESOLVED: i've put into the "EDIT FIELD" tab of the Display Settings in the Custom Field module related to my "document code" form field this simple smarty: {if $CONTEXTPAGE == "edit_submission"} {$VALUE} {/if} And it works, finally (after one month). Cheers to All, Marco |