Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants