1. Tony85
  2. Support
  3. Thursday, September 08 2016, 10:09 AM
Hello There,
I'm here to have an hint about the registration form.
I created 2 registration form using your suggestion described here.
Now, when my hidden field is set to 'Istituto', I get the new tab I added but I also see always the tab with `Name` & `Surname` fields because these are core fields and I read in this forum that cannot be hidden.
So I would like that, when my hidden field is set to `Istituto`, `Surname` field goes automatically filled with word 'do not fill' or hide it at all, while `Name` field goes automatically put equals to a custom field I added called Institute' name.
I think I can reach this stuff with a simple IF statement overriding the regfistration page, if I know the right variables where Name and Surname are stored.
I read that from Easy Profile options is possible to hide Surname field and change label of `Name` field to something else but, if I do this, alla my forms will be affected by this change, instead I want to make this change only in 1 of the 2 forms I created.
I hope I clearly explain my need.
I'm waiting for your courtesy reply.
Regards,
Antonello.
admin Accepted Answer
Admin
Hi,
sorry this is no possible but you can work with some workaround

Workaround 1 - only 1 name also for people:
- You can set in Easy Profile Options to use only 1 field to build a name (parameter is Name Style).

Workaround 2 - 1 name for Entity like Istituto and name+lastname for people
- set in Easy Profile Options to use only 1 field to build a name (parameter is Name Style).
- create a custom field (text type) for Lastname (now you can manage this like all custom fields)
- override profile template to show as title Name+Lastname(custom)
How to override template?
- copy file from /components/com_jsn/views/profile/tmpl/default.php to /templates/your-template-folder/html/com_jsn/profile/default.php
- at line 72 change title, so instead
$user->getField('formatname');
replace with
$user->getField('formatname') . $user->getField('your-custom-lastname-field-alias');
  1. more than a month ago
  2. Support
  3. # 1
Tony85 Accepted Answer
Basic
I applied Workaround #2.
Then I add to my hidden field 'usergroup', into Parameters > Conditions
Operator =equal; Field = Custom value; Istituto -->field `my-lastname-field` = HIDE
and it works very nice.
But now I miss just one step:
IF 'usergroup' == Istituto --> name (core field) = Institute' name (my custom field) !!
How to add this last condition? Can I do that into overrided default.php file?
  1. more than a month ago
  2. Support
  3. # 2
Tony85 Accepted Answer
Basic
Something like:

<?php
if ($this->form->getField('usergroup') = "Istituto")
{
$this->form->getField('cognome') == $this->form->getField('name');
}
?>


could work?

Or maybe it is possible to set a custom condition directly into database > table #__jsn_fields, then customizing column "params" for my customfield `usergroup` ??

Or adding this to default_fields.php ??

if (jform['usergroup'] = "Istituto") {
$this->excludeFromProfile[]='jform[name]';
}
  1. more than a month ago
  2. Support
  3. # 3
admin Accepted Answer
Admin
Hi,
I not understand well what you want to do :p Can you please explain me better?
  1. more than a month ago
  2. Support
  3. # 4
Tony85 Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. Support
  3. # 5
admin Accepted Answer
Admin
Hi,
AND, also, I want that `name` field (core field) is automatically filled with value of another custom field I setup called
You can copy value from another field by develop a simple plugin, follow these steps:
- Download, Install and Enable Skeleton Plugin (you will find it at http://docs.easy-profile.com/index.php/article/triggers)
- Open file /plugins/jsn/skeleton/skeleton.php
- remove samples functions: triggerFieldAvatarUpdate, triggerProfileUpdate
- add function like this:

public function triggerProfileUpdate($user, &$data, $changed, $isNew)
{
if( isset( $data['usergroup'] ) && $data['usergroup'] == 'istituto' ) {
$data['firstname'] = $data['institute_name'];
}
}

docs about our triggers at http://docs.easy-profile.com/index.php/article/triggers

NOTE: This code is not tested and not supported, this is only for example purpose. You need to have a minimum of PHP and Joomla Dev knowledges
  1. more than a month ago
  2. Support
  3. # 6
Tony85 Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. Support
  3. # 7
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.