Forums

Displaying additional Rego details

simong 27 Oct, 2010
Hi Bob / Max
I have successfully implemented a form that links with the Joomla registration component... I am now anxious to view the added fields (in this instance, height, weight, health conditions, etc) on a page.

Having used the code you suggested the other day to display the active users in a drop-down; I am wondering if I can fetch the remaining fields in a similar fashion - selecting a User will auto populate the page with the additional info fields of the registration process.

Is it possible?

Thanks in advance - appreciate your work, Simon
GreyHead 27 Oct, 2010
Hi Simon,

Yes you can do this - the Profile Page plug-in is designed to do this kind of thing. It's not well documented though (on the long to-do list). There's a basic example in Chapter 11 of The ChronoForms Book; and a slightly more complex one linked to ChronoConnectivity in the latest ChronoConnecticvity doc at greyhead.net*

Bob

* DreamHost is down right now so I can't find the correct link for that doc - it's the ChronoConnectivity View Details doc.
simong 27 Oct, 2010
Hi Bob...
Your making it really difficult for me NOT to buy that book - grrrr 🤣
I grabbed your PDF concerning the "Connectivity" method, though it did seem a little long winded... must have got in just before it went off air. Let me check the other link and get back to you.

Thanks, Simon
GreyHead 27 Oct, 2010
Hi Simon,

My site is back up. The link you posted isn't very Joomla! and while the code will work probably isn't the best approach.

Bob
simong 29 Oct, 2010
OK Bob

Have got my copy of the COOKBOOK and the horizon has opened up... just a little 😀
I was intending on using a straight article for other member details, but noticed the "SUBMIT ARTICLE" example.

Question: Can I replace the EDITOR field/area with a form?

Thanks in advance, Simon
GreyHead 29 Oct, 2010
Hi Simon,

Question: Can I replace the EDITOR field/area with a form?

I'm not sure I understand exactly what you are asking. But check the "Building a complex multi-page form" recipe in Chapter 12. The code on page 346 is taking a bunch of results from a form and assembling them into a single 'fulltext' string to be used in an article.

Bob
simong 29 Oct, 2010
Ok Bob...
Am having trouble. Have the rego process functioning... and also capturing the extended data in its own table... about 25 odd extra fields.

But for all the attempts, I just can not get this data to display... even though I have knocked the display form down to just the NAME fields. Have even copied them from the data being displayed in the associated table.. but to no avail

I am a little confused in the Profile Page plug-in parameters ... the two you have omitted in Chapter 11 - Default request and Request Parameters. (Although I am using the "cf_id" in one and cf_user_id/name/email/ etc - tried a few), my page is showing no results.

Any ideas, Simon

BTW. I will probably move to the 'multiple page form' once I have this in hand. Thanks as always!!
simong 30 Oct, 2010
Bob or Max
Further to the above I have been doing some digging in the hope it will highlight where I am going remiss. > Looking at the DISPLAY form and looking at the produced code, the string I get is as follows... I would have expected some id to be posted in the string (I understand I should paste "&cf_id=3, etc) ... am I wrong here?

<form name="ChronoContact_pkMmbrDetails" id="ChronoContact_pkMmbrDetails" method="post" action="http://www.mydomain.com.au/website/index.php?option=com_chronocontact&task=send&chronoformname=pkMmbrDetails" >

Thanks, Simon
GreyHead 30 Oct, 2010
Hi Simon,

I am a little confused in the Profile Page plug-in parameters ... the two you have omitted in Chapter 11 - Default request and Request Parameters


The "Default Request parameter value" is a value that the plug-in will use if there is no value in the calling URL. For example, you might set it to '9999' to set of a 'warning' process.

The "'Request' parameter name" is the name of the parameter that the plug-in will look for in the calling URL e.g. user_id of cf_id, etc. the URL would then need to contain something like &user_id=47

Note: this is the URL used to call the form - not the URL you see in the form action.

Bob
simong 01 Nov, 2010
Hi Bob.. seems I have myself in a real tangle...

Below is what I have...

A) The Registration form - which functions correctly and provides the basic data to "Jos_Users". It is also linked to a CF table titled "jos_chronoforms_pkMmbrshp2" which displays the remaining data (It can be seen by clicking the link on the "CF Manager" page.

B) The Form's Display Page is linked to the CF table titled "jos_chronoforms_pkMmbrshp2" via the "profile Plugin". The fields in the plugin are set out like this -
Table name:jos_chronoforms_pkMmbrshp2;
Target field name: cf_id;
'Request' parameter name: user_id=7;
Default Request: user_id=7
and the remainder - iv) ASC; v) No; vi)- vii)No

Does this all sound correct... the linking and plug-in parameters?

Another question. If I go to the TABLE MANAGER - should "jos_chronoforms_pkMmbrshp2" be ticked (marked red/active)? When I go to save it, the manager tells me some tables will be dropped.. Is that ok???

Thanks, Simon
simong 03 Nov, 2010
OK Bob... have just about cracked it.

I am getting an error message of:

Parse error: syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '$' in /home/arttwork/public_html/peakFit/components/com_chronocontact/libraries/customcode.php(64) : eval()'d code on line 45

Warning: implode() [function.implode]: Invalid arguments passed in /home/arttwork/public_html/peakFit/libraries/joomla/database/database/mysql.php on line 540



This is appearing after I hit the final SUBMIT. The contents are being saved to the 'jos_users' and my "jos_chronoforms_pkMmbrDB" (???) though is not linking to the "jos_content" table. The PARENT form is linked to the tables "jos_content" and "jos_chronoforms_pkMmbrDB"

Any idea? Thanks Simon
simong 03 Nov, 2010
Hi Bob...

I have changed the placement of some code to go AFTER the posting of the email though am getting the following error.

Parse error: syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '$' in /home/mysite/public_html/peakFit/components/com_chronocontact/libraries/customcode.php(51) : eval()'d code on line 19



Can you shed some light on this... The file is being saved to my database... though I am getting nothing in "jos_content"

TIA, Simon
GreyHead 03 Nov, 2010
Hi Simon,

The error is being reported on line 19 of the OnSubmit After code box. What do you have in there? (It may originate some lines before line 19).

Bob

Later: Corrected from line 43 of the OnSubmit Before box to line 19 of the OnSubmit After box (mental aberration)
simong 03 Nov, 2010
hi Bob... thanks,


<?php
if ( ! $mainframe->isSite() ) { return; }
$order = array("\r\n", "\n", "\r");
foreach ( $posted as $k => $v ) {
$posted[$k] = str_replace($order, '<br />', $v);
}
$_POST['fulltext'] = "<h2>".$posted['site_title']."</h2>
<h3>The Details of your Membership are as follows:</h3>
<ul><li>Name: ".$posted['name']." </li>
<li>Address: ".$posted['address']." </li>
<li>Email: ".$posted['email']." </li>
<li>Mobile: ".$posted['mobile']." </li>
<li>Emergency No. :".$posted['EMobile']." </li></ul>
<h3>More Details:</h3>
<ul><li>Occupation: ".$posted['occupation']."</li>
<li>Employer: ".$posted['employer']."</li>
<li>Date of Birth: ".$posted['age']."</li></ul>
<br />
<h3>About Your Health - </h3>
<li>Major Goals:<br />".$posted['goals']."</li><br />
<li>Injuries - Past and Present:<br />".$posted['injuries']."</li><br />
<li>Medical Issues:<br />".$posted['medical']." </li><br />
</ul>
";
?>


and then in the AFTER SUBMIT

<p><span style="color: #0000ff;"><strong>A story had been submitted to add to a Clients Progress Tracker, please review it and add the Chart and Comments prior to publishing!</strong></span></p>
<p></p>

<?php
$_POST['sectionid'] = '3';
$_POST['catid'] = '12';
$_POST['id'] = '';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");
$_POST['title'] =
JRequest::getString('site_title', 'My website', 'post');
$user =& JFactory::getUser();
if ( $user->id ) {
$_POST['created_by'] = $user->id;
}
$_POST['created_by_alias'] =
JRequest::
?>



The form/s can be found here (I have left the "debug" on):
http://www.artatwork.com.au/peakFit/index.php?option=com_chronocontact&chronoformname=pkMmbrPARENT

Thanks
GreyHead 03 Nov, 2010
Hi Simon,

Apologies - I've updated my previous post to correct the line-number and the code Box :-(

The problem is the code in the OnSubmit After box. It stops in mid-sentence:
. . .
if ( $user->id ) {
$_POST['created_by'] = $user->id;
}
$_POST['created_by_alias'] = JRequest::
?>
That last line is incomplete. I'm not sure what you intended here?

Bob
simong 03 Nov, 2010
Hi Bob,

Oddly enough, I am now getting a 403 message... I do not have permission to view the page. And the only code I added was ..

}
$_POST['created_by_alias'] =
JRequest::getString('ci_name', 'Me', 'post');


????
GreyHead 03 Nov, 2010
Hi Simon,

That's a Joomla! error being generated somewhere. Could be a result of the sub-folder.

If you try a very simple form with just a submit button does that work OK?

Bob
simong 07 Nov, 2010
Hi Bob,

Finally... after 2-3 attempts got it to work. Knocked it all down to the most elementary objects... got it to work and then built up from there.

One small final question... In this section below.. in the 'mother' form... I would like to add not just the page title; but also the NAME of the person the form concerns (the form relates to Member registration and health charactistics). So ideally the page title reads: "Progress Tracker for Name" (How would I add reference to the "name" element?)

$_POST['created'] = date("Y-m-d H:i:s");
$_POST['title'] =
JRequest::getString('site_title', 'Progress Tracker for ', 'post');
$user =& JFactory::getUser();
if ( $user->id ) {
$_POST['created_by'] = $user->id;
}
$_POST['created_by_alias'] =
JRequest::getString('name', 'Me', 'post');
?>


Thanks in advance, Simon

(URL - http://www.artatwork.com.au/peakFit/index.php?option=com_chronocontact&Itemid=19 )
GreyHead 08 Nov, 2010
Hi Simon,

I think that if you replace these two lines
$_POST['title'] =
JRequest::getString('site_title', 'Progress Tracker for ', 'post');
$user =& JFactory::getUser();
with
$user =& JFactory::getUser();
$_POST['title'] = JRequest::getString('site_title', 'Progress Tracker for ', 'post');
$_POST['title'] .= $user->name;
that should do it.

Bob
simong 22 Nov, 2010
Hi Bob..

Am back with the same problem. Again, if I add the code you are suggesting

$user =& JFactory::getUser();
$_POST['title'] = JRequest::getString('site_title', 'Progress Tracker for ', 'post');
$_POST['title'] .= $user->name;



I am getting an error message - two in fact - maybe they make sense to you -

Parse error: syntax error, unexpected '<' in /home/mysite/public_html/peakFit/components/com_chronocontact/libraries/customcode.php(64) : eval()'d code on line 8



and then after the dialogue "Next.... " (on the SUCCESS page) am getting...

Warning: implode() [function.implode]: Invalid arguments passed in /home/mysite/public_html/peakFit/libraries/joomla/database/database/mysql.php on line 540




>> If I leave this out, the form (both parts 1 & 2) functions perfectly; though the document/article title remains without the vital USER NAME.

At the moment the final code generating the article details is as follows:

... </table>
";
?>


<?php
$_POST['sectionid'] = '3';
$_POST['catid'] = '12';
$_POST['id'] = '';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");


$user =& JFactory::getUser();
$_POST['title'] = JRequest::getString('site_title', 'Progress Tracker for ', 'post');
$_POST['title'] .= $user->name;

$user =& JFactory::getUser(); if ( $user->id ) {
$_POST['created_by'] = $user->id;
} $_POST['created_by_alias'] =
JRequest::getString('name', 'Me', 'post');
?>


Any pointers would be greatly appreciated.
If you go here... you can see what I am trying to do... but need the NAMES to identify each new 'member'

http://www.artatwork.com.au/peakFit/index.php?option=com_content&view=category&id=12&Itemid=20


Thanks in advance, Simon
simong 23 Nov, 2010
Hi Bob,

I finally got it. Here was the solution that worked for me:



<?php
$_POST['sectionid'] = '3';
$_POST['catid'] = '12';
$_POST['id'] = '';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");

$_POST['title'] = 'Membership Details for ';
$_POST['title'] .=  
JRequest::getString('frstname', '',  'post');
$user =& JFactory::getUser();
if ( $user->id ) {
$_POST['created_by'] = $user->id;
}
$_POST['created_by_alias'] =
JRequest::getString('name', 'Me', 'post');
?>



I might add.. in your examples the 'title' (site_title) was replaced with "frstname" to give the string - "Membership Details for Jane"

Thanks for your help.. I will return 😀

Simon
This topic is locked and no more replies can be posted.