Scripts for Customized Home Page

Skip to first unread message

Sherry Lake

Dec 7, 2017, 11:26:09 AM12/7/17
to Dataverse Users Community
Still working on our Customized home page and was hoping for some help getting a couple of our buttons "actionable".

Here's a screen shot (since our test server is behind firewall):

I want the search button to act like the "Search this dataverse" from the top level DV.

The "Next" Button under "Add your dataset to LibraData", is a little more complicated. Based on the dataverse chosen in Step 2, we want to "Add a dataset" to the Dataverse selected.

Be glad to poke around the code for javascript if someone could point me in the right direction.


Durand, Gustavo

Dec 7, 2017, 12:04:00 PM12/7/17
Short Answer:

1. For the search, you need to go to (using demo dataverse examples): , using javascript to replace the XX with the value from the text

2. For the add, you need to go to this link:, using javascript to replace the XX with the value from the selection

Longer Answer / comments:

1. For examples of the javascript to use you can look at the search widget (or even actually imbed the widget itself):

Widget code example:

and adds this to the button:
<input id="btnDataverseSearch" value="Find" type="button" onclick="';q=' + this.previousSibling.previousSibling.value + '', '_blank');" style="-moz-border-bottom-colors:none; -moz-border-left-colors:none; -moz-border-right-colors:none; -moz-border-top-colors:none; background-color:#f5f5f5; background-image:-moz-linear-gradient(center top , #ffffff, #e6e6e6); background-repeat:repeat-x; border:1px solid #ccc; border-color:#e6e6e6 #e6e6e6 #b3b3b3; border-image:none; border-radius:4px; box-shadow:0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05); color:#333; cursor:pointer; text-shadow:0 1px 1px rgba(255, 255, 255, 0.75); padding:0.3em 1em; line-height:1.4;">

2. For the add, do you already have the select box of the dataverses working and it's just the button you need? If so see, above. If it's the dropdown, then that's (obviously) more complex. You would need to use an API to get the list of dataverses, in Json form, then translate the Json html select markup. I don't have any specific example on how to do that, but can try to help (or maybe someone else has already done it?)

Hope that helps!


You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

Reply all
Reply to author
0 new messages