Hold User Inputs after Submit?

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
peters
 
 
Posts: 64
Joined: Thu Sep 28, 2023 12:29 pm

Hold User Inputs after Submit?

Post by peters »

Good day,

maybe someone can see something I am missing here?
Scenario you have a simple add or edit page with a form inside of it holding user inputs. User selects submit, but missed entering a required entry and you have a generic webpage that is loaded to advise the user of the issue and an Try Again or Cancel button. User selects Try Again and of course off the input boxes now lost their entries.

I have a bit of code I add into the Value setting for the entry . . .
<?php if(isset($_POST['pwchgcode'])) { echo $_POST['pwchgcode']; } ?>" /><
also tried . . .
<?php if(isset($_POST['pwchgcode'])) { echo $_POST['pwchgcode']; } ?>" />

The generated HTML string is shown below:
<input type="text" id="pwchgcode" oninput="setChkMark();return false;" style="position:absolute;left:96px;top:50px;width:100px;height:29px;z-index:8;" name="pwchgcode" value="<?php if(isset($_POST['pwchgcode'])) { echo $_POST['pwchgcode']; } ?>" /><" tabindex="1" autocomplete="off" spellcheck="false">

This errors out!

However, if I remove the " and space directly in front of the tabindex="1" this resolves the code error.
So now my entire string looks like:
<input type="text" id="pwchgcode" oninput="setChkMark();return false;" style="position:absolute;left:96px;top:50px;width:100px;height:29px;z-index:8;" name="pwchgcode" value="<?php if(isset($_POST['pwchgcode'])) { echo $_POST['pwchgcode']; } ?>" /><tabindex="1" autocomplete="off" spellcheck="false">
I manually edit the file, save it and set in the WYSIWYG Web Builder project not to generate the code again and things work just fine.

Does anyone know exactly what string one could add into the textbox Value property, so things work without the manual editing and marking in the project not to generate this page?

I my coding prior to starting to use the WYWIWYG Web Builder, I hard coded the PHP code snippet manually in the first place and always used the PHP tag string successfully.

I just ponder if I am missing something to get this to work right from within the WWB project without having to manually edit the page code?

Many thanks in advance for any suggestions or work-a-rounds you may have!

Pete,
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Hold User Inputs after Submit?

Post by Pablo »

You can solve the clearing of the input when the page is reloaded by using "web storage". There is no need to write the code for this yourself.
Post Reply