Forums

Inserting text into cb_fields

birdy 30 Sep, 2010
Hello I've got the CB Registration working! But now I also want to automatically add standard text to some cb_fields. Sounds simple, but how do I do this...:? ?? For example just add '1 september 2010' to the 'member-since'-field.

Is it also possible to automatically add a certain text into a field depending on the conditions of a certain field? I.e. I want to add 'sir' or 'madam' into the 'form of address'-field, depending on cb_gender (being 'male' or 'female')?

And is it possible to merge two fields into one ('firstname&lastname')?

thanks in advance,
kind regards,
Birdy
GreyHead 30 Sep, 2010
Hi Birdy,

I think the first two questions may be better answered at the CB forums. Neither Max nor I use CB and we aren't familiar with how it works.

You can merge first_name & last_name inputs into a 'name' input - searching here on 'first_name' should find you the code.

Bob
birdy 01 Oct, 2010
Oh I'm sorry, I probably didn't make myself clear. It's about the cb_registration-plugin in Chronoforms and I'm pretty sure it is a Chronoforms question 😛

[attachment=0]cb_registration-in-chronoforms.jpg[/attachment]
Let's say I want to fill cb_land Field standard with 'Nederland'? Just simply putting the text down doesn't work...
And is it possible to fill a cb_registration-field which depends on a chronoform-field (male/female)?

Searching and browsing through this forum didn't help me answer my question, sorry...
GreyHead 01 Oct, 2010
Hi birdy,

Ah OK. I think the simple answer to this is to set the value in a hidden input to your Form HTML.
<input type='hidden' name='cb_land' id='cb_land' value='Nederland' />


For the gender and the first_name + last_name question you can process data either in the OnSubmit Before Box of ChronoForms (make sure that Send Emails is set to Yes); or the Extra OnSubmit Before box of the plug-in.
<?php
$gender = JRequest::getString('cb_gender', '', 'post');
$title_array = array('male' => 'Sir', 'female => 'Madam');
if ( $gender ) {
  JRequest::setVar('form_of_address', $title_array[$gender]);
}
$name = array();
$name[] = JRequest::getString('first_name', '', 'post');
$name[] = JRequest::getString('last_name', '', 'post');
$name = implode(' ', $name);
JRequest::setVar('name', $name);
?>


Bob
This topic is locked and no more replies can be posted.