Multiple box button in single page with one app

Highlighted
First-time Contributor

Multiple box button in single page with one app

I  have integrated box on my website Page.

It seems great.

but i want to add another same button but i am unable to do that.

please guid me how can i do this?

2 REPLIES 2
Highlighted
Box Employee

Re: Multiple box button in single page with one app

@Nikunj1 There are probably better ways to implement this, but I'll walk through one possible solution. 

 

To create additional Box upload buttons with the same style as the original one, you can add an input element with the "box-style" class. To trigger the upload popup from the additional buttons, you can pass the click on the additional button to the original button.

 

Here is an example that shows to do this:

 

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript" src="https://app.box.com/js/static/select.js"></script>
<div id="box-select" data-link-type="shared" data-multiselect="true" data-client-id="012345"></div>
<br>
<input class="box-select" type="button" id="secondButton" onclick="document.getElementById('box-select').click()" />
<script>
var options = {
  clientId: 012345,
  linkType: 'shared',
  multiselect: 'true'
};

var boxSelect = new BoxSelect(options);

// Register a success callback handler
boxSelect.success(function(response) {
});
// Register a cancel callback handler
boxSelect.cancel(function() {
});
</script>
</body>
</html>
Highlighted
Visitor

Re: Multiple box button in single page with one app

Please implement the ability to specify the DOM ID in the config, and also an option to make the auto button styling optional.

 

Or, just a function like open() that we can call for our own button events, then you only need one instance and have as many buttons as you want.

 

Or, ideally, just static functions like BoxSelect.open({}) and BoxSelect.initButton('#your-id', {})