aboutsummaryrefslogtreecommitdiff
path: root/src/components/Form
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Form')
-rw-r--r--src/components/Form/AddNewItemForm.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/components/Form/AddNewItemForm.js b/src/components/Form/AddNewItemForm.js
index 877e9f4..9286ba7 100644
--- a/src/components/Form/AddNewItemForm.js
+++ b/src/components/Form/AddNewItemForm.js
@@ -21,16 +21,16 @@ const AddNewItemForm = (props) => {
const enterItemNamePrompt = "start typing here";
const registerItemPrompt = "add new";
-
const emptyItemNames = [enterItemNamePrompt, registerItemPrompt, ""];
// Extract the model names from savedItems
- const savedItems = props.savedItems;
- let savedItemNames = [];
- for (let i = 0; i < savedItems.length; i++) {
- savedItemNames.push(savedItems[i].Model);
+ let savedItemNames= [];
+ if (props.savedItems !== []) {
+ for (let i = 0; i < props.savedItems.length; i++) {
+ savedItemNames.push(props.savedItems[i].Model);
+ }
}
-
+
// set description and price
// when item is entered
const setItemInfo = (itemName) => {
@@ -156,9 +156,10 @@ const AddNewItemForm = (props) => {
</div>
<div className={"menuButtons"}>
- <input type="button" value="Register New Item" onClick={() => {
- alert("this shit refuses to work")
- }} />
+ <input type="button"
+ value="Register New Item"
+ onClick={() => props.registerFormVisibility(true)}
+ />
<input type="button" value="Placeholder1" />
<input type="button" value="Placeholder2" />