Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

SmartPasteButton - Use outside the form #29

Open
spib opened this issue Mar 22, 2024 · 1 comment
Open

SmartPasteButton - Use outside the form #29

spib opened this issue Mar 22, 2024 · 1 comment
Milestone

Comments

@spib
Copy link

spib commented Mar 22, 2024

Hi

This is awesome, thanks so much for putting this together.

My question is would it be possible to put the button outside the form tag and then add an attribute to tell it which for to use?

<smart-paste-button default-icon form=“myform” />

Our use case is that the button would ideally be positioned on the page above the form

@SteveSandersonMS
Copy link
Contributor

Yes, that seems reasonable.

In the short term, you could work around this by putting the smart paste button inside the form, but using CSS to hide it (display: none). Then add a completely separate button into the page above the form, and script it so that when the user clicks it, it behaves as if the smart paste button was clicked, e.g.:

<button onclick="document.getElementById('my-smart-paste-button').click()">Smart Paste</button>

<form>
    <SmartPasteButton id="my-smart-paste-button" style="display:none" />
</form>

Of course, you could do it without the inline script in onclick in other ways, but hopefully you get the idea.

@SteveSandersonMS SteveSandersonMS added this to the backlog milestone Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants