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

Add a way to opt-out for some fileds #12

Open
dbochicchio opened this issue Mar 18, 2024 · 2 comments
Open

Add a way to opt-out for some fileds #12

dbochicchio opened this issue Mar 18, 2024 · 2 comments

Comments

@dbochicchio
Copy link

First of all: brilliant work!

I have very large forms where I know certain fields are usually ignored and not pasted.

I think a way to ignore certain fields via data attribute (ie: data-smartpaste-ignore="true") could speed up the computing and save some tokens.

Even something like ```data-smartpaste-explicit="true"on the form and thendata-smartpaste-include="true"`` on the fields we want to use could be OK.

@SteveSandersonMS
Copy link
Contributor

SteveSandersonMS commented Mar 19, 2024

Very good suggestion, thanks.

A pattern we've often used in other products is to allow it to be set hierarchically. So for each field, we'd scan up the DOM hierarchy to find the closest element (which could be the field itself, or some parent div, or the parent form, or the top-level <html> element) that has a data-smartpaste-include attribute.

So:

  • Since the default is "include", you could exclude by putting data-smartpaste-include="false" on the input element itself
  • Or if you want to change the default to be "exclude", you'd do that by putting data-smartpaste-include="false" on the <form>, and then put data-smartpaste-include="true" on individual fields.

That's almost the same as what you already suggested, except slightly generalizing it so you can put this attribute at any level in the hierarchy.

@pierslawson
Copy link

@SteveSandersonMS would / could your idea allow two smart buttons within the same form, where one button dealt with one set of inputs and the other a different set?

An example might be a single form into which the user can enter details of both a person and their partner. Many of the fields are essentially the same e.g. FirstName, PartnerFirstName. The user probably has the source information in seperate locations so would not be pasting both people's data in one go, so having two buttons "Smart Paste Client and "Smart Paste Partner" might solve the problem.

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

3 participants