
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
redux-form-react-submitbutton
Advanced tools
A submit button for redux form that dynamically changes based on the current form state
A submit button for redux-form that dynamically changes based on the current redux-form state.
https://deedmob.github.io/redux-form-react-submitbutton/example/
yarn add redux-form-react-submitbutton
npm install redux-form-react-submitbutton
@reduxForm({
form: 'account'
})
class AccountForm extends React.Component {
render(){
<form>
<Field name="email" component={TextInput} />
<SubmitButton />
</form>
}
}
There are no required props
static defaultProps = {
// Button class names
className: 'btn',
disabledClassName: 'btn-outline',
successClassName: 'btn-success',
errorClassName: 'btn-danger',
okClassName: 'btn-primary',
submittingClassName: 'btn-default',
invalidClassName: 'btn-warning',
// added to outer div wrapper of error alert box
syncErrorClassName: 'alert alert-danger',
// Header text to add to the error alert box
labelErrorAlert: 'Please double-check that these fields are correct and try again',
buttonStyles: {},
// Lets you pass a function that maps from Field `name` to something
// to field name to show in list of errors in box
translateKeys: key => key,
// Should the box describing submission errors be shown on submitFailed?
showErrors: true,
// How long should a Submission Error or Success be shown before reseting?
asyncStatusDuration: 2000,
// Button type, for quicker start, but could be removed from this library
type: 'Submit',
// Button text labels
labelSubmitting: '...Submitting',
labelSubmitFailed: 'Submission error',
labelSubmitSucceeded: 'Success!',
labelInvalid: 'Invalid',
// Button labels, used based on which prop `type` this button has
labelSubmit: 'Submit',
labelUpdate: 'Save Changes',
labelPost: 'Post',
labelCreate: 'Create',
// Icons set is by default font-awesome icons, and are added as classNames for an <i> element
iconStyles: { marginRight: '5px' },
showIcons: true,
iconSubmit: 'fa fa-paper-plane-o',
iconUpdate: 'fa fa-floppy-o',
iconPost: 'fa fa-rocket',
iconCreate: 'fa fa-plus',
iconError: 'fa fa-times',
iconWarning: 'fa fa-warning',
iconSubmitting: 'fa fa-spinner fa-pulse fa-fw',
iconSuccess: 'fa fa-check'
}
static propTypes = {
asyncStatusDuration: PropTypes.number,
type: PropTypes.oneOf(['Create', 'Post', 'Update', 'Submit']),
showIcons: PropTypes.bool,
iconSubmit: PropTypes.string,
iconUpdate: PropTypes.string,
iconPost: PropTypes.string,
iconCreate: PropTypes.string,
iconError: PropTypes.string,
iconWarning: PropTypes.string,
iconSubmitting: PropTypes.string,
iconSuccess: PropTypes.string,
translateKeys: PropTypes.func,
labelErrorAlert: PropTypes.string,
showErrors: PropTypes.bool,
className: PropTypes.string,
syncErrorClassName: PropTypes.string,
disabledClassName: PropTypes.string,
successClassName: PropTypes.string,
errorClassName: PropTypes.string,
okClassName: PropTypes.string,
invalidClassName: PropTypes.string,
submittingClassName: PropTypes.string,
buttonStyles: PropTypes.object,
iconStyles: PropTypes.object,
syncErrors: PropTypes.object.isRequired,
syncWarnings: PropTypes.object.isRequired,
submitting: PropTypes.bool.isRequired,
submitFailed: PropTypes.bool.isRequired,
submitSucceeded: PropTypes.bool.isRequired,
invalid: PropTypes.bool.isRequired,
pristine: PropTypes.bool.isRequired,
labelSubmitting: PropTypes.string,
labelSubmit: PropTypes.string,
labelUpdate: PropTypes.string,
labelPost: PropTypes.string,
labelCreate: PropTypes.string,
labelInvalid: PropTypes.string,
labelSubmitFailed: PropTypes.string,
labelSubmitSucceeded: PropTypes.string
}
yarn run test
Import this library and create your own React Component that wraps it, and passes in your configuration options or internationalization library. Then export that Component and use the new Component in all your forms.
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.