Fixing forms enter key press issue

This commit is contained in:
Daniel Gonzalez
2025-03-24 18:43:15 -04:00
parent 165141ea41
commit 3c0fe9ab00
5 changed files with 13 additions and 10 deletions
+3 -2
View File
@@ -14,7 +14,8 @@ function GetBalance (props) {
const [textInput, setTextInput] = useState('')
// Button click handler
const handleGetBalance = async (event) => {
const handleGetBalance = async (e) => {
e.preventDefault()
try {
// Exit on invalid input
if (!textInput) return
@@ -43,7 +44,7 @@ function GetBalance (props) {
<Container>
<Row>
<Col className='text-break' style={{ textAlign: 'center' }}>
<Form>
<Form onSubmit={handleGetBalance}>
<Form.Group className='mb-3' controlId='formBasicEmail'>
<Form.Label>Enter any BCH address to query its balance on the blockchain.</Form.Label>
<Form.Control type='text' placeholder='bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d' onChange={e => setTextInput(e.target.value)} />
@@ -259,7 +259,7 @@ function SendCard (props) {
<Row>
<Col xs={12} style={{ textAlign: 'center' }}>
<Form>
<Form onSubmit={(e) => e.preventDefault()}>
<Form.Group controlId='formBasicEmail' style={{ display: 'flex', alignItems: 'center' }}>
<Form.Control
style={{ marginRight: '1rem' }}
@@ -289,7 +289,7 @@ function SendCard (props) {
<Row>
<Col xs={12}>
<Form style={{ paddingBottom: '10px' }}>
<Form style={{ paddingBottom: '10px' }} onSubmit={(e) => { e.preventDefault(); handleSendBch({ sendCardData, appData }) }}>
<Form.Group controlId='formBasicEmail' style={{ textAlign: 'center' }}>
<Form.Control
type='number'
@@ -77,7 +77,7 @@ const WalletImport = (props) => {
<Container>
<Row>
<Col xs={12} className='text-break' style={{ textAlign: 'center' }}>
<Form>
<Form onSubmit={(e) => e.preventDefault()}>
<Form.Group className='mb-3' controlId='formImportWallet' style={{ display: 'flex', alignItems: 'center' }}>
<Form.Control
style={{ margin: '1rem' }}
@@ -51,7 +51,8 @@ function SendTokenButton ({ token, appData, refreshTokens }) {
// Click handler that fires when the user clicks the 'Send' button.
const handleSendTokens = async () => {
const handleSendTokens = async (e) => {
e.preventDefault()
try {
setStatusMsg('Preparing to send tokens...')
setHideSpinner(false)
@@ -131,7 +132,7 @@ function SendTokenButton ({ token, appData, refreshTokens }) {
<Row>
<Col xs={10}>
<Form>
<Form onSubmit={(e) => e.preventDefault()}>
<Form.Group controlId='formBasicEmail' style={{ textAlign: 'center' }}>
<Form.Control
type='text'
@@ -161,7 +162,7 @@ function SendTokenButton ({ token, appData, refreshTokens }) {
<Row>
<Col xs={10}>
<Form style={{ paddingBottom: '10px' }}>
<Form style={{ paddingBottom: '10px' }} onSubmit={handleSendTokens}>
<Form.Group controlId='formBasicEmail' style={{ textAlign: 'center' }}>
<Form.Control
type='text'
+3 -2
View File
@@ -40,7 +40,8 @@ const SweepWif = (props) => {
}
// Handle sweep function
const handleSweep = async () => {
const handleSweep = async (e) => {
e.preventDefault()
try {
console.log(`Sweeping this WIF: ${wifToSweep}`)
@@ -157,7 +158,7 @@ const SweepWif = (props) => {
<Row>
<Col>
<Form>
<Form onSubmit={handleSweep}>
<Form.Group controlId='formWif' style={{ textAlign: 'center' }}>
<Form.Control
type='text'