Custom site registration form

Custom site registration form

by David Bennett -
Number of replies: 2

Hi all,

I've been battling with a custom site registration form and just as I thought it would work - nothing.

The client requires that certain fields are required depending on whether other choices have been made. So if choice A is "yes" then choices B and C should be visible and required.

I've been hacking signup_form.php and signup.php to add and arrange standard and custom profile fields as well as fiddle with the form logic (visibility of different sections on/off) and bypass the client-side validation for fields that are currently invisible.

But when I click on the submit button the page reloads, no validation complaints, nothing.

All the fields I create are of the same types as the custom user profile fields (using advcheckbox for checkbox items).

You can see and test the site at here

Debugging mode is on full and I'm not seeing anything complaining about anything - it just doesn't work. auth.log has one entry at the time for a registration attempt but I don't think that's relevant.

Mar 25 14:05:29 Moodle sshd[17709]: Did not receive identification string from 192.168.xx.xx

Can anyone give tips as to how to get the system to talk to me? Any experiences to share with similar endeavours? All insights greatly appreciated.

Thanks

David

Average of ratings: -
In reply to David Bennett

Svar: Custom site registration form

by David Bennett -

Update:

It's complaining about null values being written to the db. The value in question is the first custom select element but I can read and manipulate that in the validation function and the output buffer below shows that there is a value to the data.

The data with field id == 3 is [profile_field_employerType] => municipality

Can anyone offer an explanation?


Thanks

Error writing to database
More information about this error
Debug info: Column 'data' cannot be null
INSERT INTO mdl_user_info_data (userid,fieldid,data) VALUES(?,?,?)
[array (
0 => 28,
1 => '3',
2 => NULL,
)]
Error code: dmlwriteexception
Stack trace:
  • line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1164 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1210 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 147 of /user/profile/lib.php: call to mysqli_native_moodle_database->insert_record()
  • line 491 of /user/profile/lib.php: call to profile_field_base->edit_save_data()
  • line 100 of /auth/email/auth.php: call to profile_save_data()
  • line 70 of /login/signup.php: call to auth_plugin_email->user_signup()
Output buffer: stdClass Object ( [firstname] => test@test109_2.com [lastname] => test@test109_2.com [email] => test@test109_2.com [email2] => test@test109_2.com [username] => test@test109_2.com [password] => test@test109_2.com [profile_field_gender] => 0 [profile_field_dateofbirth] => 1427324400 [profile_field_careworker] => 0 [profile_field_employerType] => municipality [profile_field_municipality] => 0127 [submitbutton] => Create my new account [confirmed] => 0 [lang] => en [firstaccess] => 1427372339 [timecreated] => 1427372339 [mnethostid] => 1 [secret] => eEgEk66FC5Ob0Jm [auth] => email [firstnamephonetic] => [lastnamephonetic] => [middlename] => [alternatename] => ) 
In reply to David Bennett

Re: Custom site registration form

by Andrew Shaw -

I'm required do the same thing with our sign up page. Did you just edit the php file with your own JS code to achieve this?


Thanks, 


Andy