Hello,
I have tried really hard to find out how to autofill text area with joomla user's username. But although reading lots of posts and the documentation I could not get it to work.
Let's say I have a form with just one text field "username" and a submit button. What do I have to do on setup page when using Wizard designer to make it autofill with the logged in user's username? I understand that it has to do with custom code and maybe also DB read. And I need to fill in some custom code, but I don't now what and where exactly.
Could anyone with experience give me a short step by step info how to set it up? That would be great 😀
Thanks and regards,
Andy
Btw, it worked in CFv4 and I'm not quite sure it works in v5. But it's worth trying😉
.. well, I just realized, that the email part is not working! It outputs an error in the text field saying, that email is not displayed because of spam protection (I have Honeypot enabled). And submitting the form results in an endless loading..
Maybe someone knows how to get that to work, too?
I think think the code I posted is not working at all if you want to send an email including that data. Sorry, I was too rash 😶
The same for marcinwolejko's code. It is displaying the user data, but it is not included in mail when send on submit.
Hi innoads.
I've put the code in a custom element PHP/ HTML (CFv4), gave the element name: username, id: username.
Then in the email template action just put the username in brackets {username} and on test email I've got it to work and send all the data I needed.
Hi marcinwolejko,
I have set it up pretty similar in V5. Used your code. Only difference is that for custom element it is only possible to set the label in the designer (not name or id). It was however inserted automatically into the mail template like <tr><td>Custom</td><td>{custom}</td></tr> in Email element on setup page.
But does not send the value via mail, only the label Custom.
in v5 the custom element doesn't get a name or id, because it may not contain an input at all, or may contain many, so its the user's duty to include the input's name in the email if they do so!🙂
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
That makes sense and works fine with the username.
What I still do not get to work is joomla user's email. If I use email instead of name in marcinwolejko's code following is displayed in the form field as plain text (and email value is empty):
<script type='text/javascript'> <!-- var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy92611 = 'MY-EMAIL' + '@'; addy92611 = addy92611 + 'gmail' + '.' + 'com'; document.write('<a ' + path + '\'' + prefix + ':' + addy92611 + '\'>'+ addy92611+ '<\/a>'); //-->\n </script><script type='text/javascript'> <!-- document.write('<span style=\'display: none;\'>'+ 'Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!'+ '</'+ 'span>'); //--> </script>
PS: The German output means "This e-mail adress is protected against spambots! To display it JavaScript must be enabled" (which is enabled in browser)
.. while no spam protection element is used.