Fabrik form element data not displayed completely in article

Joppo2

Member
In a Joomla article I use some fabrik code by means of the fabrik content plugin + the joomla sourcerer extension (http://www.nonumber.nl/extensions/sourcerer), pls see code below.

The error is that for the het_donation___name_organisation db field currently a text value with 3 words ('Wijkvereniging Kijkduin Groen') is saved but only the first word ('Wijkvereniging') is displayed in the form??? When I simply echo the db value all 3 words are displayed.

Pls your help.

Code:
{source}
 
<?php
 
$db = JFactory::getDbo();
 
$query = $db->getQuery(true);
 
$query
 
    ->select(array('id','organisation','projectname','status'))
 
    ->from('#__crprojects')
 
    ->where('approved = ' .'"Goedgekeurd"');
 
$db->setQuery($query);
 
//echo $query->dump();
 
$projects = $db->loadAssocList();
 
for($i=0,$i_max=count($projects);$i<$i_max;$i++){
 
    echo '{fabrik view=list id=4 het_crprojects___id='.$projects[$i]['id'].'  layout=mydiv fabrik_show_nav=0}';
 
  if($projects[$i]['status'] == 'poll_interest'){
 
    echo $projects[$i]['organisation'];  //test - shows all 3 words saved in db field
 
    echo '{fabrik view=form id=9 fabrik_show_nav=0 het_donation___id_project='.$projects[$i]['id'].' het_donation___name_organisation='.$projects[$i]['organisation'].' het_donation___projectname='.$projects[$i]['projectname'].'  }'; //ERRROR: $projects[$i]['organisation'] only shows first word
 
  }//if
 
}//for i
 
?>
 
{/source}
 
I presume if you just view the form normally the data for the database join element is correctly shown?
Could you post the URL to the page generated with your code?
Have you tried validating the HTML generated by that page, my first thought might be that there is some unescaped content somewhere which is creating invalid markup
 
I presume if you just view the form normally the data for the database join element is correctly shown?
correct, that's what I checked with the testline "echo '{fabrik view=list id=4 het_crprojects___id='.$projects[$i]['id'].' layout=mydiv fabrik_show_nav=0}';"


Could you post the URL to the page generated with your code?

Unfortenately not, I'm only developing the code at my laptop at the moment. Pls see attached screendump (if that is of any help).

Have you tried validating the HTML generated by that page, my first thought might be that there is some unescaped content somewhere which is creating invalid markup
Not sure how to validate that code in a simple way. But the problem is at the line:
Code:
echo '{fabrik view=form id=9 fabrik_show_nav=0 het_donation___id_project='.$projects[$i]['id'].' het_donation___name_organisation='.$projects[$i]['organisation'].' het_donation___projectname='.$projects[$i]['projectname'].'  }';
This line of code is supposed to prefill the form with some database values. Which it does, but for the formfield 'het_donation___name_organisation' the database value is some text and contains 3 words (with spaces in between), and only the first word "wijkvereniging" is prefilled.

When I simplify that line of code to (prefilling only the one formfield) to:
Code:
echo '{fabrik view=form id=9 fabrik_show_nav=0 het_donation___name_organisation='.$projects[$i]['organisation'].'  }'; //test

..the same happens.

! And, when I for example change the databasevalue related to the formfield 'projectnaam' from one word to two words the same happens!, e.g. only the first word is displayed.

I have the impression that the content plugin somehow does not render this line properly (??).
 

Attachments

  • Screen Shot 2014-08-06 at 12.40.07.png
    Screen Shot 2014-08-06 at 12.40.07.png
    27.7 KB · Views: 196
This line of code is supposed to prefill the form with some database values. Which it does, but for the formfield 'het_donation___name_organisation' the database value is some text and contains 3 words (with spaces in between), and only the first word "wijkvereniging" is prefilled.

Oh of coures silly me, I see what you mean now. Its because the content plugin explodes the statement on ' '. So it reads your second word as a new property.

If you update from github, this commit https://github.com/Fabrik/fabrik/commit/a16fed965b319176b69d36c0872c64c12b21b3a4 tweaks the content plugin to accept html encoded text, so if you change your code to

PHP:
$projectId =  str_replace(' ', '&nbsp;', $projects[$i]['id']);
$org =  str_replace(' ', '&nbsp;', $projects[$i]['organisation']);
$projectName = str_replace(' ', '&nbsp;', $projects[$i]['projectname']);
echo '{fabrik view=form id=9 fabrik_show_nav=0 het_donation___id_project=' . $projectId  .'  het_donation___name_organisation=' . $org . ' het_donation___projectname=' . $projectName . '  }';

All the words should be put into the form's field


For validating the HTML I use firefox's html tidy plugin https://addons.mozilla.org/en-US/firefox/addon/html-validator/

For accessing sites running on local host I find this a useful service https://ngrok.com/
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top