ORCID Researcher Lookup Widget

What is this widget?

The ANDS ORCID Widget allows you to enhance your web form to include the ability to lookup and search for an ORCID ID.

This widget is powered by the ORCID JSONP API and requires jQuery to function.

How to use this widget

Put the following code snippet into your HTML document between the <head> tags.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js"></script>
<script type="text/javascript" src="//researchdata.ands.org.au/apps/assets/orcid_widget/js/orcid_widget.js"></script>
<link rel="stylesheet" type="text/css" href="//researchdata.ands.org.au/apps/assets/orcid_widget/css/orcid_widget.css" />

And you’re done! Just 3 lines of code! Any input fields on your page which have the class orcid_widget will be transformed into a fully-functional ORCID lookup tool.

Demo

DEFAULT SETTINGS

This example shows how to embed a Researcher Lookup tool into your webpage.

  • if you don’t know your ORCID, click Search to search for your ORCID profile
  • if you already know your ORCID, put it into the text field and click Lookup instead

 

CUSTOM SETTINGS

Example 1

In this example, we initialise the widget using some custom settings:

  • the labels on the page have been changed (see the JS tab)
  • automatically display the search box when the widget loads
  • a default value for the ORCID has been set in the HTML tab (and this is displayed when the page loads)

Example 2

Another example where we initialise the widget using custom settings (see the JS tab):

  • Set styling of the search form div
  • Set styling of the orcid information div

Note: You will need to add the supplied classes to your style sheet to apply formatting.

Example 3

Another example where we initialise the widget using custom settings (see the JS tab)

  • Enable tooltip of full information on mouseover of the results list

Note: This feature requires the qtip jquery plugin to be installed to display correctly.

Configuration

You can initialise the plugin by simply adding a class of orcid_widget to an input element (demo):

<input type="text" class="orcid_widget">

You can also manually trigger the plugin with Javascript:

$('input').orcid_widget();

In this mode, you can pass the orcid_wiget() function any of the following configuration parameters:

Property Description Default
search_endpoint JSONP search API for ORCID http://pub.orcid.org/search/orcid-bio?q=
lookup_endpoint JSONP API for ORCID Lookup service http://pub.orcid.org/
pre_lookup Automatically Do a lookup on the current value of the input field false
search Display Search Button, enable searching functionality true
pre_open_search Open Search Box by default false
search_text Text to display on the open search box button <i class="icon-search"></i> Search
search_class CSS class to apply on the open search box button orcid_search btn btn-small
lookup Display the Lookup button, enable Lookup functionality true
lookup_text Text for the lookup button Look up
lookup_class Lookup button CSS class orcid_lookup btn btn-small
before_html: Text to display before the input field <span class="orcid_before_html">http://orcid.org/</span>
wrap_html The wrapping HTML to cover the input fields <div class="orcid_wrapper"></div>
result_success_class CSS class for the div displaying successful lookup orcid_success_div
result_error_class CSS class for the div displaying error lookup orcid_error_div
search_div_class CSS class for the searching div orcid_search_div
nohits_msg Message to display when no result or an error returns <p>No matches found<br/>
If you wish to register for an
orcid please click
<a href="https://orcid.org/register" target="_blank">here</a></p>
query_text Text displaying before the search query Search Query:
search_text_btn Text display for the search button Search
close_search_text_btn Text display for the closing search div button [x]
lookup_error_handler overwrite function for error lookup function(xhr, message) false
lookup_success_handler overwrite function when a successful lookup returnsfunction(data, obj, settings) false
post_lookup_success_handler a function hook after a successful lookup returnsfunction(data, obj, settings) false
auto_close_search boolean, To automatically close the search box after a value is selected false
tooltip boolean To enable tooltip on mouseover of result list to display details. NOTE: jquery qtip module is required to use this feature false
info_box_class Text to set a class to style the individual results info-box
search_div_class Text to set a class to style the search form div orcid_search_div

Comments 3


  1. Hello,

    I have added the 3 lines of code to the HTML page. However I have not been able to launch the program widget as your instructions state it would. Do I have to add something to the configuration file at all?

    • ands_admin Post author

      Hi Francesca,

      I’m sorry for this late reply – I did not receive the notification that you had made a comment 🙁

      Nothing would be needed to be done on the configuration file. It may well be the case that the widget javascript file is loaded before the page (including your input element) is ready. It may be necessary to add the following code to your html page

      $(document).ready(function(){
      $(‘.orcid_widget’).each(function(){
      var elem = $(this);
      var widget = elem.orcid_widget();
      });
      });

      We will be releasing version 2 of this widget in a couple of weeks where this change has been included. Also with version 2 a user will be able to register for and supply an api_key so that we can notify them of future updates.
      Could you please make these changes and let us know how you go.

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × 1 =