From 8fd165a79b5f1d6cd4b6042e7b7bfc9f6e7c3f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 21 May 2024 23:43:56 +0200 Subject: [PATCH] form changes --- .../pages/archivePage/archivePage.jsx | 35 +++++++++++++------ .../pages/archivePage/archivePage.less | 2 +- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/client/homebrew/pages/archivePage/archivePage.jsx b/client/homebrew/pages/archivePage/archivePage.jsx index f271c2f95..4f6aab683 100644 --- a/client/homebrew/pages/archivePage/archivePage.jsx +++ b/client/homebrew/pages/archivePage/archivePage.jsx @@ -120,7 +120,7 @@ const ArchivePage = createClass({ const title = document.getElementById('title').value || ''; const v3 = document.getElementById('v3').checked; const legacy = document.getElementById('legacy').checked; - + this.setState({ totalBrews: null, }); @@ -164,6 +164,16 @@ const ArchivePage = createClass({ ); }, + validateInput: function (e) { + const textInput = e.target + const submitButton = document.getElementById('searchButton'); + if (textInput.value.length > 3) { + submitButton.disabled = false; + } else { + submitButton.disabled = true; + } + }, + renderForm: function () { return (
@@ -176,6 +186,9 @@ const ArchivePage = createClass({ type="text" name="title" defaultValue={this.state.title} + onKeyUp={(e) => { + this.validateInput(e); + }} onKeyDown={(e) => { if (e.key === 'Enter') { this.loadTotal(); @@ -191,15 +204,14 @@ const ArchivePage = createClass({