0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 06:32:37 +00:00

form changes

This commit is contained in:
Víctor Losada Hernández
2024-05-21 23:43:56 +02:00
parent ecfdada810
commit 8fd165a79b
2 changed files with 25 additions and 12 deletions

View File

@@ -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 () { renderForm: function () {
return ( return (
<div className="brewLookup"> <div className="brewLookup">
@@ -176,6 +186,9 @@ const ArchivePage = createClass({
type="text" type="text"
name="title" name="title"
defaultValue={this.state.title} defaultValue={this.state.title}
onKeyUp={(e) => {
this.validateInput(e);
}}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
this.loadTotal(); this.loadTotal();
@@ -191,15 +204,14 @@ const ArchivePage = createClass({
</small> </small>
<label> <label>
Results per page Results per page
<input <select name="pageSize" id="size">
id="size" <option value="6">6</option>
type="number" <option value="10" default>10</option>
min="6" <option value="16">16</option>
step="2" <option value="20">20</option>
max="30" <option value="24">24</option>
defaultValue={this.state.pageSize} <option value="30">30</option>
name="pageSize" </select>
/>
</label> </label>
<label> <label>
@@ -230,11 +242,12 @@ const ArchivePage = createClass({
*/} */}
<button <button
className="search" id="searchButton"
onClick={() => { onClick={() => {
this.loadTotal(); this.loadTotal();
this.loadPage(1, true); this.loadPage(1, true);
}} }}
disabled
> >
Search Search
<i <i

View File

@@ -83,7 +83,7 @@ body {
input { input {
margin: 0 10px; margin: 0 10px;
} }
.search { .searchButton {
position:absolute; position:absolute;
right:10px; right:10px;
bottom:20px; bottom:20px;