Hi to all experts..
First of all... sorry for my english...
I need a little help...
I've a form with some field.. I would like to fill a "read-only" textbox (disabled textbox) with the value 'id-name' of a logged user.
so.. i know that i can do
but.. how i can put this value in the disabled textbox value??
Thank's in advance
First of all... sorry for my english...
I need a little help...
I've a form with some field.. I would like to fill a "read-only" textbox (disabled textbox) with the value 'id-name' of a logged user.
so.. i know that i can do
<?php
$user =&JFactory::getUser();
$id = $user->id;
$nome = $user->name;
?>
but.. how i can put this value in the disabled textbox value??
Thank's in advance
Hi giacall,
Please see this FAQ it talks about the On Submit event but will work equally well in the On Load event.
Bob
Please see this FAQ it talks about the On Submit event but will work equally well in the On Load event.
Bob
Hi GreyHead.
Thank for replay..
I read the faq you suggest to me.. Bu t i think is for CV4. I'm using CF5....
BTW..
I can use the $user array through the code
Then i've my information in
What i cannot do is "write" the $user->name in the value option of a textbox...
The FAQ refer to DB Record Loader Action.. wich is not present in CF5 (i think the corrispective is DB READER)
Thank's in advance
Thank for replay..
I read the faq you suggest to me.. Bu t i think is for CV4. I'm using CF5....
BTW..
I can use the $user array through the code
<?php
$user =& JFactory::getuser();
?>
Then i've my information in
$user->name
What i cannot do is "write" the $user->name in the value option of a textbox...
The FAQ refer to DB Record Loader Action.. wich is not present in CF5 (i think the corrispective is DB READER)
Thank's in advance
Hi giacall,
You are right that the FAQ was written for CFv4 and the code should still work for CFv5. Have you tried it?
Bpb
You are right that the FAQ was written for CFv4 and the code should still work for CFv5. Have you tried it?
Bpb
OOOOkkkkkkkk... Ok ok...
So... I tryed with the example in FAQ you suggest me previously, mixed with FAQ How to load record data from a database table into your form and How can I edit a record from a database table?
Finally, with CF5 and DB Reader, i can load the id and email from users table.. Set 2 textbox id with "id" and "email" and setting a DBReader event in ONLOAD section (above HTML RENDER FORM) with
in condition field, i can have the ID and EMAIL of a unic user registered in joomla.
But.. If i would to have the id and email of a currently logged in user, i suppose i've to use the custom code action in onload section..
I tryed with this code in CUSTOM CODE ACTION:
And.. of course ... it does not work..
Can you xplain me hoe to use the form data array, and how to have the current logged in user ID and email in 2 separated text box??
Thank's in advance
So... I tryed with the example in FAQ you suggest me previously, mixed with FAQ How to load record data from a database table into your form and How can I edit a record from a database table?
Finally, with CF5 and DB Reader, i can load the id and email from users table.. Set 2 textbox id with "id" and "email" and setting a DBReader event in ONLOAD section (above HTML RENDER FORM) with
<?php
return array("id" => form->data("id"));
return array("email" => form->data("email");
?>
in condition field, i can have the ID and EMAIL of a unic user registered in joomla.
But.. If i would to have the id and email of a currently logged in user, i suppose i've to use the custom code action in onload section..
I tryed with this code in CUSTOM CODE ACTION:
<?php
$user =& JFactory::getUser();
$id = $user->id;
$email = $user->email;
return array($id => $form->data("id"));
return array("$email" => $form->data("email"));
?>
And.. of course ... it does not work..
Can you xplain me hoe to use the form data array, and how to have the current logged in user ID and email in 2 separated text box??
Thank's in advance
OPS...
Hello GreyHead..
The form works fine.. Was my mistake on PHP code (and on my very basic know about array....)
The right code in CUSTOM CODE action is :
Thank's for your help!!!
Hello GreyHead..
The form works fine.. Was my mistake on PHP code (and on my very basic know about array....)
The right code in CUSTOM CODE action is :
<?php
$user =& JFactory::getUser();
$id = $user->id;
$email = $user->email;
$form->data['id'] = $id;
$form->data['email'] = $email;
?>
Thank's for your help!!!
Hi giacall,
You seem to be making this very complicated :-(
What are the names of the text-boxes that you want to use to show the name and id?
Bob
You seem to be making this very complicated :-(
What are the names of the text-boxes that you want to use to show the name and id?
Bob
You seem to be making this very complicated :-(
You are right.. But as i wrote in my last post.. Was my mistake in PHP code.
Now works fine..
Thank's
This topic is locked and no more replies can be posted.