Add new dropdown section on User Edit

I got a tip from this discussion (https://ask.gibbonedu.org/discussion/2698/php-how-to-change-items-in-a-dropdownlist-how-to-create-a-new-list) and added a dropdown menu with editing FormFactory.php

public function createSelectProgram($name)
{
return $this->createSelect($name)->fromArray(array(
'US' => __('Ultrasound'),
'ECHO' => __('Echocardiography'),
'BS' => __('Bachelor Program'),
'ESL' => __('ESL')
))->placeholder();

After a successful show-up of the dropdown section, I found that it couldn't save the selected result in any dropdown menu I selected.

How can I solve this problem?

Comments

  • Hi Paul, welcome to the Gibbon community! :smiley: It's great to see that you're getting into the codebase and making changes. In this case, you'd also need to update the manage_users_editProcess.php page to handle the new value, and then add a field to the database to store it, as well as update the queries in the process page to write that value.

    Luckily, when it comes to user data, there is an easier way to add new fields. In User Admin, look for the Manage Custom Fields section. Here you can define new fields and they can show up on the user page as well as optionally as part of the application form and the data updater.

    Hope this helps!
  • Thank you for your kind reply Sandra. I have one more question regards of this, I knew the custom field section can provide additional section very easily. But I want to place each questions to other section such as basic information or school information. Is there anyway to place custom field section part to other part, separately?
  • Hi Paul,

    At the moment there is no way to do this, but it is an idea we would like to build in due course. For now, the only way to achieve this would be to get into the codebase for your install and adjust it. Such hacks, however, get overwritten when you update Gibbon, so do take care to record the changes that you make.

    Thanks,

    Ross
Sign In or Register to comment.