To be more specific, I am creating a character sheet for Pf2e for a project. I have a 'Character Schema' which includes all of my various inputs (normal text/number, checkboxes, and textarea inputs). I can get it to work with 1 input, but I'm sure there is an easier way than writing the following:
<% if(characterData.length === 1){ %>
<input class="larger-input" id="id1" type="text" placeholder="" name="ancestry" value="
<%= characterData[0].ancestry %>">
<% } else { %>
<input class="larger-input" id="id1" type="text" placeholder="" name="ancestry" value="">
<% } %>
Basically, if the user has never "saved" data before I was getting an ejs error. So the previous code says 'if there is data, show it, else show an empty field'. Im really new at all this and I know some other frameworks help, but I am doing this with strictly vanilla JS, Node(Express + mongoose) and EJS. The code can be found here https://github.com/TartCodes/main-character-manager First post on here, sorry for the length! Any help is appreciated!