Hi,
I managed to build a user registration form, to be used instead of Joomla's default registration form.
Now, I am trying to build a form to edit the user's information. I managed to read the users information. However, when the form is submitted, it doesn't save the new information.
For troubleshooting purposes, I created a "custom code" entry at the bottom of the "On Load" section, and another one at the top of the "Submit" section. As you can see below, the "id" is available at the former, while it is NOT available at the latter. What am I missing?
-------- First - "custom code" at the bottom of the "On Load" section:
------ Second - "custom code" at the top of the "Submit" section:
Notes:
1. Before db Read - Custom Code:
2. db Read - Setup - Conditions:
3. db Read - On Found - Custom Code:
4. db Save - Setup - Conditions:
5. Overview:
The attached screen shot shows the complete setup.
I managed to build a user registration form, to be used instead of Joomla's default registration form.
Now, I am trying to build a form to edit the user's information. I managed to read the users information. However, when the form is submitted, it doesn't save the new information.
For troubleshooting purposes, I created a "custom code" entry at the bottom of the "On Load" section, and another one at the top of the "Submit" section. As you can see below, the "id" is available at the former, while it is NOT available at the latter. What am I missing?
-------- First - "custom code" at the bottom of the "On Load" section:
<?php
echo "<p> <b>end of OnLoad:</b> </p>";
echo "<p> {$form->data[user_id]} - {$form->data[id]} </p>"; // Both have values
foreach ( $form->data as $key=>$value )
{ echo "<p><b>" . $key . ":</b> " . $value . "</p>"; }
// >>>>>> The id exists - GREAT
?>
------ Second - "custom code" at the top of the "Submit" section:
<?php
echo "<p><b> start of Submit: </b> </p>";
echo "<p> {$form->data[user_id]} - {$form->data[id]} </p>"; // Neither one has a value
foreach ( $form->data as $key=>$value )
{ echo "<p><b>" . $key . ":</b> " . $value . "</p>"; }
// >>>>>> The id does NOT exist - NO GOOD
?>
Notes:
1. Before db Read - Custom Code:
$user =& JFactory::getUser();
$form->data[id] = $user->id;
$form->data[user_id] = $user->id;
2. db Read - Setup - Conditions:
<?php
return array('id' => $form->data[id]);
?>
3. db Read - On Found - Custom Code:
$form->data['email'] = $form->data[jUser][email];
$form->data['username'] = $form->data[jUser][email]; // imp to save
$form->data['firstname'] = $form->data[jUser][name];
4. db Save - Setup - Conditions:
<?php
return array('id' => $form->data[id]);
?>
5. Overview:
The attached screen shot shows the complete setup.
Hi bilal.abdeen,
The screenshot didn't make it. You have to Upload attachments before you submit the post here :-(
How are you passing the id from the load event to the submit event? Do you have it in a form input? Or are you getting it again from the Joomla! User Object?
Be very careful about using id as a variable name - it will be overwritten if there is an id in the page URL e.g. from an article id.
Bob
The screenshot didn't make it. You have to Upload attachments before you submit the post here :-(
How are you passing the id from the load event to the submit event? Do you have it in a form input? Or are you getting it again from the Joomla! User Object?
Be very careful about using id as a variable name - it will be overwritten if there is an id in the page URL e.g. from an article id.
Bob
GreyHead,
Thank you very much for the feedback. I thought that assigning the id to $form->data[id] would make it available throughout the form (after being defined.) However, it seems that id is a very special field that has to be defined as a form input.
I have decided to use another field $form->data[user_id], as suggested by some other FAQ or a forum topic (probably by GreyHead). This seems to be safer. If anybody is facing the same problem and reading this, I would suggest assigning the user id to $form->data[user_id] in a Custom Code. Then, use it in the Condition field for reading/saving data, i.e. <?php return array('id' => $form->data[user_id]); ?>
Now, I am struggling to make the multi-select check boxes work. It seems that there are some hints in other forum topics, which I am looking into...
This is a powerful extension. However, I think we need better documentation for the various capabilities. I think that the "search capabilities" and/or "topics and FAQ categorisation" can be improved. 😉
Thank you very much for the feedback. I thought that assigning the id to $form->data[id] would make it available throughout the form (after being defined.) However, it seems that id is a very special field that has to be defined as a form input.
I have decided to use another field $form->data[user_id], as suggested by some other FAQ or a forum topic (probably by GreyHead). This seems to be safer. If anybody is facing the same problem and reading this, I would suggest assigning the user id to $form->data[user_id] in a Custom Code. Then, use it in the Condition field for reading/saving data, i.e. <?php return array('id' => $form->data[user_id]); ?>
Now, I am struggling to make the multi-select check boxes work. It seems that there are some hints in other forum topics, which I am looking into...
This is a powerful extension. However, I think we need better documentation for the various capabilities. I think that the "search capabilities" and/or "topics and FAQ categorisation" can be improved. 😉
Hi bilal.abdeen,
FYI I use Google search and not the forum search. if you use - site:chronoengine.com search term - that works well.
Bob
FYI I use Google search and not the forum search. if you use - site:chronoengine.com search term - that works well.
Bob
Bob,
You saved me a lot of frustration... Now, I get much better results for searching my problems.
However, I could not find how to show multi selections for checkboxes or dropdowns, as I mentioned in my other topic (http://www.chronoengine.com/forums/posts/t101636/p358007.html)
Thanks
Bilal
You saved me a lot of frustration... Now, I get much better results for searching my problems.
However, I could not find how to show multi selections for checkboxes or dropdowns, as I mentioned in my other topic (http://www.chronoengine.com/forums/posts/t101636/p358007.html)
Thanks
Bilal
This topic is locked and no more replies can be posted.