SOLVED: Cannot add unknown element: new FbYesno

Status
Not open for further replies.

alanstylez

Member
I am having trouble printing forms that have the answers to Yes/No questions. Originally, users were able to read and submit their answers to the questions, which would be entered into the database (demonstrated in List view with checks and 'X's), but not displayed when revisiting the form. CorePHP found a workaround to this (not sure exactly which code they changed, but they said, "This is core bug with fabric and some jquery/javascript confliction is there."), but that workaround did not extend to the Print or PDF (details) function.

After much trouble (detailed in http://fabrikar.com/forums/index.ph...working-or-remian-selected.39954/#post-203208), I was able to alter templates/prostar/css/template.css to add '.icon-1:before,' on line 5718 and '.icon-0:before,' on line 5797 for a workaround (checks and lines are different than the checks and Xs in the Fabrik List), which extends to the Print function, but not the PDF function. BTW, when looking over the Firebug : Net : CSS console for fabrik.css, I found the following code, which may be related and may be incomplete: [class^="icon-"].small{font-size: 10px;

I have read the forums exhaustively, and even tried the recommendations on http://fabrikar.com/forums/index.php?wiki/pdf-output/, but I either did this incorrectly, or it did not solve the problem. Now I have paid $71.05 for 1 month of professional support to try to resolve this issue. I am confident that Joomla is up-to-date (v3.3.6), but not confident that Fabrik is up-to-date because it no longer shows up in Extension Manager: Update and an FTP overwrite of my site using the fabrik-joomla3.zip from github.com causes some problems (if I remember correctly).

So, to get to the good stuff, here are some selected outputs from Firebug:

Console: fabrik-min.js (line 1)
Fabrik form::addElements: Cannot add unknown element: new FbYesno('[censored]___good_health', {"repeatCounter":0,"editable":true,"value":"1","label":"Are you in general good health?","defaultVal":"1","inRepeatGroup":false,"fullName":"[censored]___good_health","watchElements":[],"canRepeat":false,"isGroupJoin":false,"validations":false,"joinid":0})

HTML:
<div class="control-group fabrikElementContainer plg-yesno fb_el_[censored]___good_health span5">
<label class="fabrikLabel control-label" for="[censored]___good_health">
<i class="icon- small "></i>
Are you in general good health?
</label>
<div class="controls">
<div class="fabrikElement">
<div class="fabrikErrorMessage"> </div>
</div>
</div>

Script:
<div class="fabrikElement">
<div class="fabrikSubElementContainer" id="[censored]___good_health">
<fieldset class="radio btn-group">
<label class="fabrikgrid_0 ">
<input type="radio" class="fabrikinput " name="[censored]___good_health[]" value="0" /><span>No</span>
</label>
<label class="fabrikgrid_1 ">
<input type="radio" class="fabrikinput " name="[censored]___good_health[]" value="1" checked="checked" /><span>Yes</span>
</label>
</fieldset>
</div><!-- close subElementContainer --> </div><!-- end fabrikElement -->

Similarly, when I look at the page source of the popup that appears when clicking the print button (https://nuvacord.net/index.php?opti...rmid=315&listid=315&rowid=92&iframe=1&print=1), I see the following:

<div class="row-fluid " ><!-- start element row -->
<div class="fabrikElementContainer plg-yesno fb_el_[censored]___good_health_ro span5">
<div class="span4 fabrikLabel">
Are you in general good health? </div>
<div class="span8">

<div class="fabrikElement">
<div id="[censored]___good_health_ro"><i class="icon-1 " ></i></div> </div>

Finally, when using PDF debug - On (PDF still doesn't show the yes or no answers in any form), I get the following from form:view:groups :
[good_health] => stdClass Object
(
[startRow] => 1
[endRow] => 0
[error] =>
[plugin] => yesno
[hidden] =>
[id] => [censored]___good_health_ro
[className] => fb_el_[censored]___good_health_ro
[containerClass] => fabrikElementContainer plg-yesno fb_el_[censored]___good_health_ro
[element] => <div id="[censored]___good_health_ro"><i class="icon-1 " ></i></div>
[label_raw] => Are you in general good health?
[label] => <label for="[censored]___good_health_ro" class="fabrikLabel control-label" >Are you in general good health?</label>
[errorTag] => <span class="fabrikErrorMessage"></span>
[element_ro] => <i class="icon-1 " ></i>
[value] => 1
[element_raw] => 1
[tipAbove] =>
[tipBelow] =>
[tipSide] =>
[offset] => 0
[column] => style="float:left;width:44%;clear:both;"
=> span5
)

So, what's the problem and how do I fix it?
 
CorePHP found a workaround to this (not sure exactly which code they changed, but they said, "This is core bug with fabric and some jquery/javascript confliction is there."), but that workaround did not extend to the Print or PDF (details) function.
Are you running "original" Fabrik (i.e. Fabrik3.2 with or without GitHub update) or a hacked version?

Fabrik3.2 needs a Joomla bootstrap (BS2) template (compatible with Protostar coming with Joomla).

Form "Print" is using the Fabrik details template (selected in form settings), this is working without issues on my site.

Form "PDF" is using the Fabrik PDF template (selected in form settings).
As mentioned in http://fabrikar.com/forums/index.php?wiki/pdf-output domPDF has it's restrictions and it is recommended to create a custom PDF template. I've added an example how to replace the yes/no icons which are not supported.

Nor with print nor PDF I can't see a fabrik-min.js or fabrik.js error.
You can enable "Debug JS" in Fabrik Options/Debug to load uncompressed JS files.

In fabrik.css I can only find
.small[class^="icon-"] {
font-size: 10px;
}
which doesn't look incomplete.

No idea where icon-1 and icon-0 are coming from on your site. Fabrik is using icon-remove and icon-checkmark.

So I assume your Fabrik code has been screwed up.
I would suggest to backup, then do a complete GitHub update and switch to Protostar template to exclude Joomla template issues.
 
what looks odd to me as well is this:

Code:
<input type="radio" class="fabrikinput " name="[censored]....

are your element named "[censored]" ? - The element admin form shouldn't allow that and should have stripped the [ and ] from the name.
 
rob - I'm assuming he's using [censored] simply to hide the table name in these posts.

As per Troester's response, it looks like at least one of your CSS files has been truncated.

And we'd need to know exactly what has been changed in the core code, before we can do any kind of support. We simply cannot support any version of Fabrik with code that has been modified, unless we know the exact differences, and even then it's not a given that we can support it, as it rather depends on what has been changed, where.

-- hugh
 
So, I'm not sure why I was hesitant about updating fabrik using the github master file, but I have done that now. I was also using a custom template, 'prostar-inline' because I want my main menu going across the screen, not down the left side of the page, but I switched that back to prostar for debugging purposes... and the yes/no answers are still missing from the pdfs.

cheesegrits was right... I [censored] my database table names to prevent sql injection into the _users table, and changed my database prefix since that had been previously published on my behalf.

The problem remains, so my next step is to follow troester's suggestion, as posted on the updated pdf-output wiki. I'll let you guys know if that works...
 
I understand that 'Docu is work in progress.', but can you be a little more clear about how to 'add custom CSS' and 'Create a custom template' in (http://fabrikar.com/forums/index.php?wiki/pdf-output/)? Right now, I'm guessing that this is done through Template Manager: Customize Template / Create Overrides / Modules / mod_fabrik_form or Components / com_fabrik, but I'm not sure...

Like I said, I did create a custom template by creating a new directory under httpdocs (Joomla home) /templates and renaming it prostar_inline, then copying all files from httpdocs/template/prostar to httpdocs/template/prostar_inline and Editing file "/css/template.css" in Template Manager: Customize Template / Editor and adding the following lines at the end:

.horizontal_menu li
{
display:inline;
list-style-type:none;
padding-right:14px;
float:left;
}
body {margin-top:1.5em;margin-bottom:1.5em}
#headerdompdf {
display:block;
position: fixed;
top: 0px;
width:100%;
height:1.1em;
border-bottom: 1px solid red;
}
#footdompdf {
display:block;
position: fixed;
bottom: 0px;
width:100%;
height: 1.1em;
border-top: 1px solid red;
}
#footdompdf .pagenum { position:absolute;
right: 20px;}
#footdompdf .pagenum:after {
content: counter(page) ; //This is including the page number at bottom right
}
#footdompdf .footleft {
color:red;
}
* {font-family:arial!important}
or
* {font-family:'dejavu sans'!important}

However, in comparing templates/prostar/css/template.css to templates/prostar/css/template.css, it seems that Joomla has added over 1000 lines of code here since I forked the template. So, it looks like I will have to recopy the template and add whatever code that we (those of you who read and write .css) decide is most appropriate to my situation.

So, again, if you guys could be a little more specific about what code needs to be added to which file, I would appreciate it.
 
BTW, simply adding the following lines to the end of httpdocs/templates/prostar/css/template.css did not fix the problem:

#{$form} .icon-checkmark:before {content:'yes'}
#{$form} .icon-remove:before {content:'no'}
 
hi
Which site is this on and which form? Your NuvaCord Network site doesn't seem to have Fabrik installed on it.

I've updated the wiki page regarding custom css files, linking to the article that explains how they are used (http://www.fabrikar.com/forums/index.php?wiki/form-and-details-templates/#the-custom-css-file)

Note the cutom css file is in fact a PHP file that is run to create the css file, hence the use of the PHP variable $form in Troesters example, and the reason why adding her example doesn't work when putting it directly in a css file.
 
Could you guys please take another look at the code for components/com_fabrik/helpers/html.php, particularly between lines 650 and 1578 to see if there could be a variable falling through the cracks and preventing style sheets from loading? I got particularly suspicious about this code since I don't think I have either the $base or $livesite variables defined. Thanks...
 
Where are you seeing $base and $livesite? That code is solid, it's in use by thousands of sites, with no problems loading CSS files.

What problem are you trying to solve, specifically? Did you fix the issue Troester mentioned, with the "or"?

If a CSS file is not loading, it is more likely due to an error on the CSS. If you look in a debugger 9like Firebug on Firefox, or Chrome's dev tools), and look at the Net tab or the CSS tab, do you see the file being fetched?

It would be a lot easier to fix this if we could get at the site, and as Rob observed, the only site in your list doesn't seem to have Fabrik installed.

-- hugh
 
I most definately have Fabrik installed at https://nuvacord.net and I have used it as my primary development tool since 1.5.22 was the most updated version of Joomla. That's right, I remember UPgrading to Joomla 1.6 and Fabrik v2. Furthermore, 'Rob_Fabrik' has been an administrator on my system since June 16th, 2011. His password was even the same for 4 years, until I recently reset it so that I could post it to http://fabrikar.com/forums/index.php?members/alanstylez.28843/, which isn't even protected by an SSL certificate. Now I'm wondering why I paid $71.05 for Professional support and I'm still spending entire work weeks trying to figure out these multi-layered programming languages that I can't read or write.

I simply want these pregnant women's health history forms to include their answers to the yes/no questions so that I can generate a .pdf record when I try to get their doctors to review their records even though they refuse to give out their email addresses. So if you guys could just focus on this problem until it is solved, I would be happy to share my Firebug reports with you, as I did on my first post after giving up hope of your standard support ever addressing the issue. Better yet, if you could just login to my website with the user account that I have authorized for you and solve this problem for me, I would really appreciate it so we can all move on with our businesses and our lives. Thanks!
 
Alright... new lead: After reading /components/com_fabrik/router.php, I realized that the rewrite conditions in my /.htaccess file may be incorrect or insufficient to generate .pdf's correctly. I tested this by trying to Export to CSV the Health History list, which gave me the error 'TypeError: g is undefined' from list-min.js (line 1). So, I opened my /.htaccess and found the following line: RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC], which I thought was interesting since I remember that all of the fabrik helpers (both html.php and pdf.php) are in /components/ but the dompdf library is not. So, I added the following line to the .htaccess file: RewriteCond %{REQUEST_URI} (/|\.csv|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] just above the other line (which is still there).

On a related note, under Global Settings / Fabrik, the JavaScript tab shows the following element: COM_FABRIK_REQUIREJS_BASE_URI_LABEL with a blank input box rendered by the following script:<input id="jform_requirejs_base_uri" type="text" size="50" value="" name="jform[requirejs_base_uri]"> Please note that neither $base_uri nor $livesite are defined in my configuration.php file (@hugh), or anywhere else... as far as I can tell. Also, I am using en-US language, not en-GB, which didn't seem to be reflected when using Debug PDF (which DOES SHOW icon-checkmark and icon-remove), but also presents the following warning:
Strict Standards: Only variables should be assigned by reference in /[censored]/plugins/system/jac_user_registration/jac_user_registration.php on line 34
 
So, I fixed the above 'Strict Standards' problem... turns out that Google (or Joomla) could have written their code better for the Google AdWords Conversion Tracker. Disabling this system plugin caused the warning to go away. I will have to resolve this later as I do use Google AdWords Conversion Tracking.

Now, back to the lecture at hand... I noticed that in /components/com_fabrik/helpers/pdf.php, line 125, it says '//otherwise continue, but it may mean that images/css/links are incorrect'. This is clearly the case, since as I mentioned above, Debug PDF (on) + Firebug (on) is still showing 'html lang="en-gb"', even though my language is en-us. More importantly, the metatag is showing
'<link href="https://cortex.progenesafe.net/multisites/nuvacord/client-registration/health-history/details/315/101?format=html" rel="canonical"><link href="/templates/protostar_inline/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">'
as opposed to '<link href="https://nuvacord.net/client-registration/health-history/[etc.]'

https://cortex.progenesafe.net/multisites/nuvacord is where my $base_uri USED to be, but as I mentioned above, I don't think that $base is properly defined at /components/com_fabrik/helpers/pdf.php, line 86 (cheesegrits). No host -> no $uri -> no $base -> no 'stylesheet' and no $tmp_path -> no $DOMPDF_FONT_CACHE -> no 'icon-checkmark' or 'icon-remove', right?

So, how and where do I define $base?

BTW, aren't you guys supposed to respond to Professional level support within 24 hours?
 
So, why do none of the elements listed under /plugins/fabrik_element/ have /language/en-US? Could this be a problem here?
 
Sorry, Super User and Access Administration Interface Permissions were both set to Inherited (Not Allowed) for usertype System Administration. I have changed that to Allowed (Allowed).

Now I understand why you guys thought I didn't have Fabrik installed...
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top