Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <aura:application extends="force:slds">
- <form aura:id="form" target="iframe" action="#" onkeypress="{!c.blockEnter}">
- <lightning:input type="text" label="Name" name="name" />
- <lightning:button label="Add to Autocomplete" iconName="utility:save" onclick="{!c.saveAutoComplete}" />
- </form>
- <iframe id="iframe" name="iframe" class="slds-hidden" />
- </aura:application>
- ({
- blockEnter: function(component, event, helper) {
- if(!component.get("v.allowed")) {
- if(event.which === 13) {
- event.preventDefault();
- }
- }
- },
- saveAutoComplete: function(component, event, helper) {
- component.set("v.allowed", true);
- component.find("form").getElement().submit();
- component.set("v.allowed", false);
- }
- })
Add Comment
Please, Sign In to add comment