Forums

Calling a Form for Editing based on User ID

mapme 04 Apr, 2011
Hi,
I want to use Chrono Connectivity to edit form data, and I can set this up easily enough.
However my workflow is as follows:
1. Logged-In User Clicks on a Main Menu item that says "Edit your Details"
2. The form table opens up from Chrono Connectivity
3. I have set the {edit} record in the table, so the User clicks on this to enter the Data-Edit stage.

Is it possible to make the link in Step #3 as the direct link from the main Joomla menu?
At the moment there are two steps to get to the Data Entry Stage - ultimately I want to reduce this down to one step to help with usability.

The record that will be called for editing will always be based on a User ID query, for example:
SELECT * from jos_users WHERE User_ID = "variable_user_id"

I guess I am looking to pass this query from a main menu item without firstly having to go into the Chrono Connectivity result.

Is this possible in Chrono Connectivity?

Thanks,

Brendan
GreyHead 06 Apr, 2011
Hi Brendan,

The main menu link would be directly to the ChronoForm to be used to edit the record. Yes, you can connect directly to a ChronoForm. You probably want to use the Profile Page plug-in to recover the data and present it for editing. This will automatically pickup the user id of the current user if they are logged in.

Bob
mapme 06 Apr, 2011
Thanks Bob,
What or where is the Profile Page plugin?!
Thanks as ever,
Brendan
mapme 06 Apr, 2011
So basically, all I need to do is call a Chronoform, and have the form set to update/edit mode... as opposed to Add New Entry mode...
Is this easily configured using Chronoengine?
GreyHead 06 Apr, 2011
Hi Brendan,

Yes, it's pretty straightforward.

As ever I'd test with a very small form, just a couple of inputs, to get the hang of how it works. Then extend or rebuild with the full form.

Bob
mapme 06 Apr, 2011
Sorry for the hassle, but where do I set it to Edit Mode instead of New Record mode?
GreyHead 06 Apr, 2011
Hi mapme ,

If the form includes a hidden input with a value for the table Primary Key and the value matches a record already in the table then the record will be updated, if there is no value or the vlaue doesn't match an existing record then a new record will be created.

Bob
mapme 03 Jul, 2011
Hi Bob,
I am trying to make some headway with your suggestion of using a hidden field with the cf_id to load existing data for updating.

I can easily do this for standard Joomla user data using the following method:

<?PHP  $user = JFactory::getUser(); ?>

 <input value="<?PHP  echo $user->username; ?>" title=""  class="radio validate-one-required" checked="checked" id="SENDER" rel="<?PHP  echo $user->username; ?>" name="SENDER" type="radio" />


Is there a similar function like getUser that allows me to do the following:
 <input value="<?PHP  echo $cf_id; ?>" title=""  class="radio validate-one-required" checked="checked" id="SENDER" rel="<?PHP  echo $cf_id; ?>" name="SENDER" type="radio" />


Think I am close with this - I guess I am looking to know how to dynamically insert form data in ChronoForms using the attached table.

Thanks a lot.

Brendan
GreyHead 04 Jul, 2011
Hi Brendan,

I'm not clear what the last example in your post is trying to do?

The simplest way to load data from a database record into your form is to use the Profile Plug-in (in CFv3) or the DB Record Loader action (in CFv4).

Bob
mapme 04 Jul, 2011
Thanks Bob,
The DB Record Loader is exactly what I need. I am only becoming familiar with J1.6 and CF4, but this has definitely put me on the right track.
Much appreciated.
Brendan
mapme 10 Jul, 2011
Hi Bob,
I am having trouble making the Record Loader work for me. Rather than a "Form Edit" opening (based on an existing matching record) a new data entry form opens. In other words, a blank form - and the existing user data is not loaded.

I want the form to load data for a specific user, if it already exists in the table. If no user ID is matched, then a blank form opens.

From this, I am deducing that I am focusing on the cf_user_id field. Therefore in the "DB Record Found" wizard I am using the following settings:
DB Field: cf_user_id
Table: myTable
Request Param: Blank
Load Fields: Yes
Model ID: Blank
Load Under Model ID: No
WHERE statement: Blank

Is there something missing, perhaps in the WHERE statement? The tooltip mentions that i it is blank then the default will be the DB field name included: "leave empty to use the default request param with column name formula OR use it to load whatever record you need."

I have not added any parameter settings to the sub-categories in the DB Record Loader (On Record Found, On Empty Result, On/No Empty Param Passed).

Really hope you can help me out... I'm guessing I'm close but can't figure this one out.

Brendan
GreyHead 11 Jul, 2011
Hi Brendan,

First - there are problems in using the cf_user_id column to do this. It's possible but you have to be very careful. The problem is that by default ChronoForms updates this with the id of the user editing the form so if an admin updates it then the value is no longer that of the originating user. For that reason I recommend adding a separate user_id column that ChronoForms won't mess with.

I think that you also need a value in the Request parameter to match up the cf_user_id. Unlike the CFv3 Profile page plug-in this will not automatically pick up the User ID.

I think that you can automate the process by putting say user_id in the Request Param box and then using Custom Code action before the DB Record Load action with this code:
<?php
$user =& JFactory::getUser();
$form->data['user_id'] = $user->id;
?>

Bob
mapme 02 Aug, 2011
Hi Adam,
There is one solution regarding the logo... Just pay!
It is the best Joomla component out there and is well worth it.
Brendan
This topic is locked and no more replies can be posted.