Franco-Henriquez / live-pokedex

School project that showcases use of REST API calls, trainer registration, mysql connectivity and API creation among other features to help scan pokemon cards or retrieve pokemon data.
0 stars 0 forks source link

pokemon search on dashboard - erases div dom changes and/or refreshes page #1

Open Franco-Henriquez opened 10 months ago

Franco-Henriquez commented 10 months ago

in the dashboard starting with line 226, the form does as it should. However, the dashboard is mainly manipulated with JS to dom. Any changes done to the dom, would naturally reset when submitting the form.

Solution Idea #1: pass in url parameters that will load the dashboard.jsp but with JS, onLoad, we read that parameter that this would decide that would initially appear. This may possibly not reload the previous modified dom from the pokemon data received and so may need to be stored in some way to reload it with that that information to make it seemless.

Solution Idea #2: May just need to keep the dashboard separate from pokemon search and work accordingly to the default nature of JSP forms.

Solution Idea #3: The javascript immediately starts editing the DOM upon a pokemon search, followed by a submission once the form DOM is manipulated. If the page reload/refresh/redirect is inevitable, then have JS determine if onLoad, the page should be the dashboard (paramater loadId=1) or the pokemon search (paramter loadId= 2) and if the loadId is 2 then retrieve the newly posted/submitted information via either a second parameter (pokedexId) or through backend session to prevent anonymous requests that would spam/flood the mysql server.

Solution Idea #4: Research newer version of Maven and see if there's other options to post and data submissions to the back-end.

Other Notes: The idea behind submitting the form, is to send data to the backend, to JAVA, in order to save the searched pokemon into the SearchHistory table model but prevent the submission from causing page/http reload.