The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
additional registration fields cleared on submit
#1
The concept of usersc/scripts/additional_join_form_fields.php works great, but I am having trouble with the two parts of validation.

My fields get validated before submit, but on submit the original user form fields get validated, like username and email, and all my additional field inputs are gone if there is an error.

That is, the user fills out the complete registration page, including the standard fields and my additional fields, the validation confirms all my required fields, but on submit they lose their additional field inputs.

I think it's because my fields are validated when the submit button is pressed but prevent the form contents from being posted, but the original user registration form fields are validated only after being posted. At that point, the error messages are displayed at the top, but all my additional form fields are now blank. (I have several fields because they are essentially applying to register).

Is there an additional step I'm missing?

Eric
  Reply
#2
Hi Eric. I want to make sure I understand your question. Are you saying that the inputs themselves are gone or the data the people typed in the inputs are gone?
  Reply
#3
(06-01-2019, 09:24 PM)mudmin Wrote: Hi Eric. I want to make sure I understand your question. Are you saying that the inputs themselves are gone or the data the people typed in the inputs are gone?

Good clarification. The input fields are still there, but they are cleared.
  Reply
#4
Ok. So what you want to do is let's say you have a text field of "address"

You would do

<input type="text" name="address" value="<?php if(!empty($_POST['address'])){echo $_POST['address'];}>

I think that's it. I'm not in my code editor, but the idea is that if a form has been posted, you need to re-echo whatever they put in the form field if it fails validation.
  Reply
#5
(06-01-2019, 10:50 PM)mudmin Wrote: Ok. So what you want to do is let's say you have a text field of "address"

You would do

<input type="text" name="address" value="<?php if(!empty($_POST['address'])){echo $_POST['address'];}>

I think that's it. I'm not in my code editor, but the idea is that if a form has been posted, you need to re-echo whatever they put in the form field if it fails validation.

That makes perfect sense. I wasn't thinking about it already being in the $_POST variable. I tried a couple fields as a test, and it's working perfectly - thank you for the help and the quick response!

I'm happy I made the choice to build on userspice!
  Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)