1) Create from in Chrono Form (ok i can do this part!)
2) User is logged in with Community Builder, which is the default login for the site.
3) User goes to fill in form, and their CB profile info (name, email, phone, etc etc including custom fields) is already there on the form, prepopulated from the CB profile into the form. But they should be able to change it if they want too.
I have looked on the forums etc to see how to do this, and I can't seem to figure it out! I hope someone can help.
Thanks,
Cheryl
simply write an UPDATE SQL statement to do this when form is submitted, this is the only way!
Cheers
Max
input type="text" name="name" value="name - grabbed from CB table based on user login" size="50"
While I'm at it is there any way the email of form submission that is returned can only display fields that have a value?
Thanks,
Cheryl
So when you are logged in and you register for an event, the form fields are prepopulated with the information available from the user account.
I hope it makes sense what I'm trying to do. I wish I was more of a programmer, but I'm not, so I need help! ๐ถ
Thanks for any assistance,
Cheryl
Go to your Chronoforms for, enable the Profile plugin, save, check your form then click the profile plugin link on the left side, configure it to the #__comprofiler table, fill in other fields, then back to your form and add {field_name} in all values attributes, read the profile plugin tooltips please and search teh forums here for profile plugin for the how to!
Cheers
Max
Thanks again for steering me!! Wish me luck ๐
Cheryl
Thanks so much for helping this new user.
Cheryl
I tried the php echo, but didn't have the syntax exactly like yours, so this was the key.
Thank you SO MUCH.
Cheryl๐
read the profile plugin tooltips
There are no tooltips yet?
I also see the table name list to choose from. I do not see such a list for the CB registation plugin, is that right?
tell me the problems you are facing exactly and I will try to write some tutorial for you and all users today!
Cheers
Max
Go to your Chronoforms for, enable the Profile plugin, save, check your form then click the profile plugin link on the left side, configure it to the #__comprofiler table, fill in other fields, then back to your form and add {field_name} in all values attributes, read the profile plugin tooltips please and search teh forums here for profile plugin for the how to!
I am an idiot Max. I had a test form that was working with this, and deleted it since I figured out how to do it. But now I'm drawing a blank, I know where to put the value="{fieldname}" but I can't remember what to put in the plugin fields.
tablename=jos_comprofiler
request param= DUH-- brain fart on my part..... what goes here?
target field name= username (DUH again but I think this is right?)
Can you let me know, and I won't delete the working test this time. Sorry ๐ถ
Cheryl
But the best part is that I also figured out how to use the info in the profile on the form in a drop down option. I'll post it here in case anyone else is interested.
<input type="text" name="first" size="20" value="{firstname}"></p>
<p>Last Name:ย
<input type="text" name="last" size="20" value="{lastname}"></p>
<p>Child:ย <select size="1" name="D1">
<option>{cb_childfname}</option>
<option>{cb_childnameb}</option>
<option>{cb_childnamec}</option>
<option>{cb_childnamed}</option>
</select></p>
<p><input type="submit" value="Submit" name="B1" "><input type="reset" value="Reset" name="B2"></p>
It picks the fields with values and adds them to the drop down. If there is no value (like no childnamec or childnamed) it just leaves it blank. ๐
It will also allow me to put more than one field in the value, like
value="{first name} {last name}"
I'm sure you guys already know this since you wrote the stuff, but I feel pretty darn smart right about now. :wink:
Probably seems simple to some, but I was very excited as this is a MAJOR function the client needs on the site and it's simple with the plugin (once you remember all the steps ๐ ).
THANK YOU Max & Bob for all your help.
I've been able to prepopulate a contact form using the methods you describe here, but I am wondering if there is any way not to have the value of a field display {fieldname} if the user is not logged in. What I mean is: Using the method here, a logged in user will see his first name in the appropriate textbox, but a user who isn't logged in will see {firstname} in the same textbox.
<?php
$my = JFactory::getUser();
if(!$my->id){
echo "you are not logged in";
return;
?>
Thank you for this info. I, too, would like to not display the {fieldname} in the value of the field if they are not logged in. You provided this:
<?php
$my = JFactory::getUser();
if(!$my->id){
echo "you are not logged in";
return;
?>
I tried it and I get a syntax error.
Parse error: syntax error, unexpected $end in /home/crptou/public_html/components/com_chronocontact/chronocontact.html.php(74) : eval()'d code on line 28
Meanwhile, I noticed that the php echo you gave me earlier for the email does not show the {fieldname} in the text area, nor does the name (which I figured out how to do with the php echo as well!!)
<?php global $my; echo $my->email; ?> or <?php global $my; echo $my->name; ?>
Is there a php echo statement we could use for the value of the field instead of the {fieldname}? I have tried replacing the email or name with the fieldname: for example <?php global $my; echo $my->phone; ?> , where phone is the fieldname I want, but that's not doing it.
Or can you help me get the original php statement you posted to work? Thank you!
Cheryl
The first code block is missing a closing } - that's what gives you the error message.
<?php
$my = JFactory::getUser();
if ( !$my->id ) {
echo "you are not logged in";
return;
}
?>
Textarea doesn't take a value attribute, you can put the value between the tags instead. Not tested but this should work:
<textarea name="field_name" . . . >{field_name}</textarea>
Bob
I'll try the new code (I told you I wasn't a programmer!! There is not enough vodka in the world for me to keep track of all those squiggly lines and symbols... ๐คฃ )
Textarea doesn't take a value attribute, you can put the value between the tags instead. Not tested but this should work:
Code: Select all
<textarea name="field_name" . . . >{field_name}</textarea>
It's not a text area, just a text field. Sorry if I didn't make that clear. But that might come in handy as well someday!!
Cheryl
hi, get it with <?php global $my; echo $my->email; ?> assuming you have J1.0.x
How would this be done in J1.5.x?
Thanks.
<?php
$my = JFactory::getUser();
echo $my->email;
?>
I set out to do this, didn't quite get it from the faq, and then found this thread which worked like a charm. I still have one issue though. Some forms need to be visible to both public and registered users, but I'd still like to let the registered users have the perk of having the form prepopulated, while public users would just see a regular blank form (rather than disabling the form entirely).
This concept seems to work for me (with $my = JFactory::getUser() at the top of the form):
<?php if ($my->id) echo "{fieldname}" ?>
But is there a way to do that more efficiently? It seems like there must be a way of just checking once if a user is logged in and if not ignoring any plugin values, but I'm with Cheryl having brain farts on this one (and also not a programmer).
more efficiently then wait for the next release, I think I will solve that issue permanently, every form record will be assigned to the user submitted it too, forms will have access permissions and more control.
Regards
Max
<?php if ($my->id) echo "{fieldname}" ?>
in my CF form it is being stripped out when the form is published...I'm trying to get the CB registration data to populate the fields in CF I've setup the CB Registration plugin to reference the correct fields, but that appears to allow the CF form to update CB not the other way around...or am I missing something? Thanks in advance for any help.
$my = JFactory::getUser();
as kavaXtreme mentinoned, this line is necessary, also, if you are trying to populate a form fields with some data using Chronoforms, you should make a form and assign the profile plugin to it, after configuring the profile plugin and using the formula you have, the form will load the data from some table!
Cheers
Max