Change the custom fields with dropdown in signup page

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
ikatikah
Posts: 6
Joined: 2017-02-02 04:05

Change the custom fields with dropdown in signup page

Post by ikatikah » 2017-05-04 08:51

Hello,

Here I am trying to change the fields in signup page from input text field into a dropdown menu that is filled with the data from inside my own database.

Tried using it much like the groupID but to no avail because the name and id for the dropdown is not for custom fields but for the data from my database.

Here's what I've done so far
This is from the appgini code which lets you to choose the group

Code: Select all

$groupsDropDown = preg_replace('/<option.*?value="".*?><\/option>/i', '', htmlSQLSelect('groupID', "select groupID, concat(name, if(needsApproval=1, ' *', ' ')) from membership_groups where allowSignup=1 order by name", ($cg == 1 ? sqlValue("select groupID from membership_groups where allowSignup=1 order by name limit 1") : 0 )));
	$groupsDropDown = str_replace('<select ', '<select class="form-control" ', $groupsDropDown);
This is what I modified to get the data from inside my database

Code: Select all

	$NegeriDropDown = preg_replace('/<option.*?value="".*?><\/option>/i', '', htmlSQLSelect('Kod_Negeri', "select Kod_Negeri, concat(Nama_Negeri) from ruj_negeri order by Kod_Negeri", ($cg == 1 ? sqlValue("select Kod_Negeri from ruj_negeri order by Kod_Negeri limit 1") : 0 )));
	$NegeriDropDown = str_replace('<select ', '<select class="form-control" ', $NegeriDropDown);
Any kind of help is gracefully accepted because the dropdown is a success but the data itself is not saved by the server because the dropdown class and id is not custom2 but instead Kod_Negeri. I would like to make the dropdown to be for custom2 but as of now to no avail.

ikatikah
Posts: 6
Joined: 2017-02-02 04:05

Re: Change the custom fields with dropdown in signup page

Post by ikatikah » 2017-05-04 09:41

I managed to get the dropdown to save the signup info properly.

The modification I tried so far is just change the 'Kod_Negeri' with 'custom2' to make it recognize as the custom2 field but the saved data is only saving the value of the Kod_Negeri and not the Nama_Negeri which is what I wanted.

Can anyone help please as to how the groups can catch the name instead of the numeric value of the groupID, I tried it with my own field but still to no avail.

Post Reply