Hey,
I'm trying to make a standard contact form for my website.
In this, i would like to have following data:
[list]Username
e-mail
message [/list]
Is there a way to pull the first 2 field from the joomla user tables? This way, the visitor doesn't need to put it in (maybe only change it on the contact form if he wants).
I'm trying to make a standard contact form for my website.
In this, i would like to have following data:
[list]
Is there a way to pull the first 2 field from the joomla user tables? This way, the visitor doesn't need to put it in (maybe only change it on the contact form if he wants).
Hey,
Thanks for the quick response!
Seems it's that what I need.
I just can't figure out how to create a text field with a standard value the joomla username. And when it's not a user or not logged in, it should stay empty. And this field should be viewable since a non user should also be able to fill in the field.
But i'll give it another try tomorrow. Today i've seen to much computers... :wink:
Already thanks!!!
Thanks for the quick response!
Seems it's that what I need.
I just can't figure out how to create a text field with a standard value the joomla username. And when it's not a user or not logged in, it should stay empty. And this field should be viewable since a non user should also be able to fill in the field.
But i'll give it another try tomorrow. Today i've seen to much computers... :wink:
Already thanks!!!
Hello,
If you place the code in a "Custom code" action before the "show html" and the form field name match the index in the data array then this should do it, e.g:
And set your field name to "user_email"
Regards,
Max
If you place the code in a "Custom code" action before the "show html" and the form field name match the index in the data array then this should do it, e.g:
<?php
$user =& JFactory::getUser();
$form->data['user_email'] = $user->email;
?>
And set your field name to "user_email"
Regards,
Max
hmmm,
Not working (yet)...
I don't understand what you mean 'before show html'.
This is the way i've created the form (wizard edit):
1. Custom code
2. Text Box 1
3. Text Box 2
4. Text Area 1
5. Submit button
And this is how my e-mail template looks like
The mail is arriving properly. But the fiels username and email stay empty.
Nor do i see on the form page the fields being field in...
Am i missing something?
Thanks!
Not working (yet)...
I don't understand what you mean 'before show html'.
This is the way i've created the form (wizard edit):
1. Custom code
<?php
$user =& JFactory::getUser();
$form->data['user_email'] = $user->email;
$form->data['user_username'] = $user->username;
?>
2. Text Box 1
Field name: user_username
3. Text Box 2
Field name: user_email
4. Text Area 1
5. Submit button
Field name: message
And this is how my e-mail template looks like
Username: {user_lidnummer}
Email: {user_email}
Message: {message}
The mail is arriving properly. But the fiels username and email stay empty.
Nor do i see on the form page the fields being field in...
Am i missing something?
Thanks!
The "Custom code" action should be placed BEFORE the "Show html" action inside the "on load" event in your "form wizard".
Did you try that ?
Did you try that ?
Ahhh, big difference between 'Form Wizard' and 'Easy From Wizard'. 😶
I've created a new form to test it.
But when i add the code in 'events' - 'On Load', i've got following error:
ps i'm using "Joomla! 3.0.2" on a small homeserver (test). Not sure if it's important, but anyway...
I've created a new form to test it.
But when i add the code in 'events' - 'On Load', i've got following error:
Strict Standards: Only variables should be assigned by reference in /administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(19) : eval()'d code on line 2
ps i'm using "Joomla! 3.0.2" on a small homeserver (test). Not sure if it's important, but anyway...
Okay, putting the loglevel to 'none' helps for the warning.
But my mail arrives empty.
I've added a debug in the loop (after the custom code)
Events > First 'on load' > Custom code
Preview > text box (Testdata)
The output gives me:
Data Array:
Validation Errors:
testdata:
But my mail arrives empty.
I've added a debug in the loop (after the custom code)
Events > First 'on load' > Custom code
<?php
$user =& JFactory::getUser();
$form->data['user_email'] = $user->username;
?>
Preview > text box (Testdata)
field name = user_email
The output gives me:
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => test
[user_email] =>
)
Validation Errors:
Array
(
)
testdata:
HI brononius,
This will only work if the user is logged in.
You probably want their $user->email and not the $user->username
Other than that the code you posted looks OK to me.
Bob
This will only work if the user is logged in.
You probably want their $user->email and not the $user->username
Other than that the code you posted looks OK to me.
Bob
Okay, found what I was doing wrong.
I configured the form by the backend and tested it with the button "test form".
And since i wasn't logged in on the frontend, i didn't see the data. 🙄
So your tip was helpfull!
And the remark about email/username was also correct. Not the problem, but details can do a lot.😉
I can start to build the forms now.
Btw payment is on the way...
I configured the form by the backend and tested it with the button "test form".
And since i wasn't logged in on the frontend, i didn't see the data. 🙄
So your tip was helpfull!
And the remark about email/username was also correct. Not the problem, but details can do a lot.😉
I can start to build the forms now.
Btw payment is on the way...
This topic is locked and no more replies can be posted.