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
/showthread.php 26 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
/showthread.php 26 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
/showthread.php 26 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
/showthread.php 26 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
/showthread.php 26 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
/showthread.php 26 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 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
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 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
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 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
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 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
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 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
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 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key "mybb" - Line: 1952 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1952 errorHandler->error
/inc/functions_indicators.php 41 my_set_array_cookie
/showthread.php 629 mark_thread_read
Warning [2] Undefined property: MyLanguage::$ratings_update_error - Line: 5 - File: showthread.php(732) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(732) : eval()'d code 5 errorHandler->error
/showthread.php 732 eval
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_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
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_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "invisible" - Line: 1506 - File: showthread.php PHP 8.1.27 (Linux)
File Line Function
/showthread.php 1506 errorHandler->error
Warning [2] Undefined variable $threadnotesbox - Line: 30 - File: showthread.php(1533) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 30 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $addremovesubscription - Line: 79 - File: showthread.php(1533) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 79 errorHandler->error
/showthread.php 1533 eval



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
Form Builder / Custom Fields - Show a Field on every form page?
#1
I've created my second custom field, but I've run into an issue.

It's a field I need to add values to with Javascript, it needs to appear on every page (hidden), and it needs to add to the existing data in the field if present.

Is there a read-made way to add a field to every tab?

Barring that, is there an easy way to find and get $field_info to add the field directly to the Form Page template in a custom Form Builder template? I can't find much documentation on how to access other properties of the form... from what's available, it looks like you only have ready access to the groups/fields assigned to that tab/page when it is called.

Alternately, in the Custom Fields "Save" script, is the a variable available with the data in the DB, if the field already held data? Or would I need to use what I get from POST to write a DB query for it? I could just write the input field to the template manually, and combine it with existing data when saving.

Thank you,
John
Reply
#2
Ok, I believe I have come up with a solution. By the way, my custom template set began as a clone of Default Template Set.

Poking around with {{php}} tags, I found {{$view_info}}. {{$view_info.fields}} is an array of every field in the View, whether on the current tab or not.

The field has to be in a group to be in the field list. It also has to be "editable" for the {{edit_custom_field}} call to put it on the page.

So I created a "Universal Hidden Fields" group, and a placeholder for the group ID. I would have preferred group name, but {{$view_info}} doesn't have a full list of the View's groups, only the groups for the current tab.

Note that the only field in my group is a custom field, type="hidden", and this code does not display the group name. If you want a repeating group that is visible on the page, or want to hide repeating core fields, modify accordingly.

I placed this inside the opening <form> tag, just after the {{$published_form_id}} hidden input.

Code:
{{foreach from=$view_info.fields item=curr_field}}
  {{if $curr_field.group_id == $P.universal_field_group}}
    {{edit_custom_field form_id=$form_id field_info=$curr_field field_types=$field_types
      settings=$settings submission_id=$submission_id}}
  {{/if}}
{{/foreach}}

By the original Smarty code of the Page Template from the Default Template Set, the hidden field group would display on whichever tab it was placed. To prevent this, you need to exclude the group ID. Note, I had already restructured this, so that there was only a single {{if $fields|@count}}, with the {{foreach from=$fields item=curr_field}} inside.

Code:
{{foreach from=$grouped_fields key=k item=curr_group name=row}}
  {{assign var=group value=$curr_group.group}}
  {{assign var=fields value=$curr_group.fields}}
  
  {{if $fields|@count > 0 && $group.group_id != $P.universal_field_group}}
    {* Display Start of Group Here *}
    
    {{foreach from=$fields item=curr_field}}
      {* Display Field Here *}
    {{/foreach}}
    
    {* Display End of Group Here *}
  {{/if}}
  
{{/foreach}}

EDIT:

I did miss something. {{$view_info.fields}} does not contain submission values... so in my Custom Field Display Edit code, {{$VALUE}} was empty. With some more prodding, this PHP worked.

PHP Code:
$form_id $this->get_template_vars("FORM_ID");
  
$submission_id $this->get_template_vars("SUBMISSION_ID");
  
$field_name $this->get_template_vars("NAME");
  
$submission_info ft_get_submission_info($form_id,$submission_id);
  
$value $submission_info[$field_name];
... 

I'm not sure how safe it is to call a core function from a Smarty {{php}} tag, so if anyone knows a better way, please let me know.

Hope this helps someone in the future. Smile
Thanks for Form Tools.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)