-
Notifications
You must be signed in to change notification settings - Fork 18
EmailForm Widget v7
- status : complete
- version : 7.x
EmailForm is a widget that displays standard text input for email with validation.
- email: An initial email set in the form.
- showSubmitBtn: If TRUE, a submit button is added below the form. Default: TRUE. (dev version)
-
onsubmit: Options passed to
getValues
when the submit button is pressed. Default:
{
emailOnly: true,
send: true,
updateUI: true
}
- setMsg: If TRUE, a SET message (automatically stored in the memory database of the logic) is sent. Default: a SAY message (requires a custom event listener on the recipient).
- label: 'Enter your email:'
- errString: 'Not a valid email address, please correct it and submit it again.',
- sent: 'Sent!' (dev version)
getValues(options): Returns the value held by the form. Configuration options:
- emailOnly: If TRUE, returns just the email (see usecase). Default: FALSE.
- verify: If TRUE, check if the email is valid. Default: TRUE.
- reset: If TRUE, it resets after reading it. Default: FALSE.
- markAttempt: If TRUE, wrong emails are added to the attempts array and returned (see usecase). Default: TRUE.
- updateUI: If TRUE, the UI (form, input, button) is updated. Default: FALSE.
- highlight: If TRUE, if email is not the valid, widget is is highlighted. Default: (updateUI || FALSE).
- send: If TRUE, and the email is valid, then it sends a SAY or SET msg (see option setMsg). Default: FALSE.
- sendAnyway: If TRUE, it sends a msg regardless of the validity of the email. Default: FALSE.
- say: same as send, but deprecated.
- sayAnyway: same as sendAnyway, but deprecated
None.
None.
// Creates and append a new DoneButton widget.
var root = document.body;
var emailForm = node.widgets.append('EmailForm', root);
emailForm.getValues({ emailOnly: true });
// Returns:
// { value: some.email@email.com }
emailForm.getValues();
// Returns:
// {
// values: some.email@email.com,
// time: 123144354324,
// attempts: [ 'not-an-email.com', 'again-not-an-email' ]
// }
Go back to the wiki Home.
Copyright (C) 2021 Stefano Balietti
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.