FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Filed not displayed
#1
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
Reply
#2
Hey Marco,

Can you post the code please?

Cheers,

Joe
Reply
#3
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

Reply
#4
No suggestions ??

Heeeelp !! Smile

Marco
Reply
#5
Hi All...nobody can help me ???

Sad

Marco
Reply
#6
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
Reply
#7
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
Reply
#8
You should to post the code on it to display.
Reply
#9
No suggestions for me ??

Heeellllpppp Smile
Reply
#10
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)