I am trying to create a "Settings" area for people...just a simple form page that would update single relationship elements... for example, "What is your favorite color". In this example, I don't see where a user could edit just one field telling me what their favorite color is. I could allow them to insert a record, but that would also allow them to insert multiple records... which is something I don't want. How would I do this in AppGini? I have tried for the last 4-5 hours to get a simple form page for my users, but I haven't yet found a solution.
Things I have tried:
- Creating a table, restricting the records to owner.
Problem: The owner could create multiple records. I don't want that.
- Creating a hook to go directly to edit view with SelectedID=<id number>
Problem: I won't know which selectedID to send this particular user to until they create their first record.
Another way to ask - I want to create a page that functions very similarly to /membership_profile.php .. is there anything in AppGini that can allow me to do this?
Thanks,
-Seth.
Simple Form Page?
-
- Posts: 3
- Joined: 2014-05-01 20:40
Re: Simple Form Page?
Ok, I figured out a way to do it. Basically, what I did is created a mysql trigger that inserts a record to the table I want the user to add. Then, I turn off the insert options for the group, and only allow view/edit. Once that's done, we're all set. Here's the trigger I used:
delimiter #
create trigger create_offers_post_registration after insert on membership_users
for each row
begin
insert into offers (username, description) values (new.memberID, 'Click to Edit');
insert into membership_userrecords set tableName = 'offers', pkValue = last_insert_id(), memberID = new.memberID, dateAdded = unix_timestamp(), dateUpdated = unix_timestamp(), groupID='3';
end#
delimiter ;
Hope that helps someone... took me the better part of a day to figure it out.
delimiter #
create trigger create_offers_post_registration after insert on membership_users
for each row
begin
insert into offers (username, description) values (new.memberID, 'Click to Edit');
insert into membership_userrecords set tableName = 'offers', pkValue = last_insert_id(), memberID = new.memberID, dateAdded = unix_timestamp(), dateUpdated = unix_timestamp(), groupID='3';
end#
delimiter ;
Hope that helps someone... took me the better part of a day to figure it out.