EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #09594


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] How to convert metadata input from a radio button to a checkbox

  • To: "NURUL NADIAH BINTI ROSLAN ." <nnadiahroslan@iium.edu.my>
  • Subject: Re: [EP-tech] How to convert metadata input from a radio button to a checkbox
  • From: David R Newman <drn@ecs.soton.ac.uk>
  • Date: Thu, 8 Feb 2024 07:47:57 +0000

Hi Nadiah,

I cannot remember for certain whether the original column in the database table is removed when a file is migrated from being a single to a multiple value field.  I expect it is not, just in case you realised you had done this in error, as it likely impossible to migrate the field back the other way, as it is uncertain what to do with eprint records that have multiple values set for a field if it becomes a single value field again.  If you retain the single value field as a column in the eprint table, you can at least revert to this if you realise your change to multiple was in error, However, you will not get the changes to these values since the change to making it a multiple field.

What you need to do is check whether there is now an eprint_myra_type table in your database.  A table rather than a single row is required for multiple value fields to be able to store the one (eprint) to multiple (myra_type) relationship.  If that has been created then the migration has been successful.  It is probably worth doing a "SELECT * FROM eprint_myra_type;" from the MySQL command line to both confirm that the values from when it was a single value field are present and that when you check or uncheck myra_type values (then save the eprint record) this table is suitably updated.

Regards

David Newman

On 08/02/2024 2:23 am, NURUL NADIAH BINTI ROSLAN . wrote:


CAUTION: This e-mail originated outside the University of Southampton.
Hi David,

I'm Nadia,

Based on a previous email on how to convert metadata input from radio button to checkbox.

I have followed your suggestion. To edit eprint_field.pl and add multiple =>1  and the checkbox input successfully shows on the screen. 
image.png

image.png

After that, update the database using command:

image.png
I have done all the above steps but I am still concerned, the column for my field 'myra_type'  is not inserted to the multiple selection values, the column is null after saving the record. 

image.png

image.png


Please advise me on this matter. Thank you in advance.

Have a nice day.

Regards,
Nadiah

On Fri, Jan 26, 2024 at 10:37 AM Noorhafizah Mohd Akil <noorhafizah_ma@iium.edu.my> wrote:
Assalammualaikum.

Nad, for your references, ini tentang isu checkbox yang akak pernah tanya David.



Noorhafizah Binti Mohd Akil

Information Technology Officer

Library,

International Islamic University Malaysia
Tel: 03-61960 3827
HP: 012-9754684



 Please consider the environment before printing this email



---------- Forwarded message ---------
From: David R Newman <drn@ecs.soton.ac.uk>
Date: Tue, Sep 26, 2023 at 3:48 PM
Subject: Re: [EP-tech] How to convert metadata input from a radio button to a checkbox
To: <eprints-tech@ecs.soton.ac.uk>, Noorhafizah Mohd Akil <noorhafizah_ma@iium.edu.my>


Hi Fiza,

You will need to add the "multiple => 1," attribute to the field definition.  However, I would advise doing this first on a test or pre-production server of your EPrints repository as it will require modifying the the database.  There should generally be no problem with such a database change but if it turns out not to make the change you want then changing and then reverting the database change has some small inherent risk of data loss/corruption.

As this looks to be a bespoke field, it may have been added to your archive's eprint_fields.pl but it may have been added elsewhere.  You should be able to find eprints_fields.pl or another configuration files this field has been added to under the following path (substituting EPRINTS_PATH and ARCHIVE_ID as appropriate):

EPRINTS_PATH/archives/ARCHIVE_ID/cfg/cfg.d/

As you have made the field into a multiple, you will need to update the database so this goes from being a column in a database table to its own database table using the following command (again substituting placeholders):

EPRINTS_PATH/bin/epadmin update ARCHIVE_ID

Once done you will need to reload your webserver (e.g. apachectl graceful) and EPrints indexer.  The latter of these can be done from the Admin menu of the web interface.

For further information see the wiki page about set fields [1].  If this field is not of type set it will be a sub-type of this field and therefore the configuration is still applicable.

Regards

David Newman
[1] https://wiki.eprints.org/w/Set_field


On 26/09/2023 4:42 am, Noorhafizah Mohd Akil wrote:
CAUTION: This e-mail originated outside the University of Southampton.
CAUTION: This e-mail originated outside the University of Southampton.
Hello, I'm Fiza. I hope your team could assist me in resolving this matter. I am new to using EPrints EPRINTS RELEASE: 3.3.15, and this metadata  (MyRA Type) has already been created by the IT person back in 2016. I need to convert this metadata input from a radio button to a checkbox, so users can choose more than one MyRA Type.
image.png

The question is, how can I achieve this? Also, does changing the input type from a radio button to a checkbox, also require modifications to the database table structure as well?


Below is the design table for the EPrints table in the database:
image.png

And below are the phrases edited in the config file:
image.png

Thank you in advance.


*** Options: https://wiki.eprints.org/w/Eprints-tech_Mailing_List
*** Archive: https://www.eprints.org/tech.php/
*** EPrints community wiki: https://wiki.eprints.org/