Database Retrieve/Get Button

I have a membership database where a user fills out a form and submits to create his member record in a database. I have duplicated the input form so I can allow the user to update his info, but I need the Get button in order to retrieve the member’s entry into the form. All I see for button is Submit, Next, and Previous? Also how/where would I input the record key? Perhaps another page the then links to the input form upon successful database entry retrieval?

Hi,

Maybe using a Read & Write permission for your dynamic page dataset will do the job of displaying and allowing to change info of database.
Have a look here .

Hope this helps,
Liran.

Maybe this will give you a different approach …2017 Create Member Profile Log In Page - Custom Private Client Member Dashboard - Wix Code - YouTube

Thanks Nayeli, I already have the form created with 19 inputs and a submit button already connected to the database. When I selected the page name setting on the left I see an option to set as a dynamic page. Doing so, it takes me to the Create page, then ITEM type page, then the URL page with instructions to add fields, then the Start Creating… ? I don’t want to have to do this again?

Nayeli, I was well along into following your video and had the your code pasted in. Then when adding the Onclick function, I realized I did not have the properties panel open. When I clicked the check box and opened it, once I added the onClick it REPLACED my code with that default code stub??? Is that normal?
Thanks
JD

Thanks Nayeli, I was able to get the login to work. Now working on the Profile Update portion.

1 Like

Hey CWVEGA76,

For some reason my email notifications were lost (in sea of hundreds of emails) over the Thanksgiving weekend. Glad you got it working.

To answer the above: yes, it’s normal. Watch other videos to help you out on the rest. :slight_smile:

Sorry, for the delay in response. I was on a cruise ship for a week. Status right now: I have implemented the create a member profile. The Login button IS working… when I login, it changes from Login to then show Logout, along with the My Profile. However, when I click on My Profile, nothing is happening? What did I miss?

Did you add onclick to your profile button?
Did you edit the code to match your actual member profile dynamic page?
Does your dynamic page have the ID added to the URL?

ARTICLE: Velo Tutorial: Building Your Own Members Area | Help Center | Wix.com

"When the profile button is clicked, we use an event handler to send members to their personal profile page.We add an event handler by selecting the profile button and we use the Properties panel to add a handler for the onClick event. Then we add the event handler code, which looks like this:


(Remove yourself as a member and sign up again)

I have done everything in the article. What is confusing to me is the URL on the button3_onclick.
If I look at my Pages list. I see:
CVOA-MemberProfile Pages that appears as a folder. Underneath and indented it shows:
CVOA_Members ID(All) with the Settings Wheel. When I click on that I get Blue window that shows in the
Page Info Tab:

This dynamic pages shows data from the following collection:
CVOA_Members

What’s the Page URL? The fields you add to the page URL control what is displayed when the page loads/

http://www…/ CVOA-MemberProfile ID

Add Field


Am I supposed to add each field that is to be included on the profile form that I created?

Then your code would look like this on the last part …

export function profileButton_click(event) {
wixLocation.to(/CVOA/${wixUsers.currentUser.id}); }

or export function profileButton_click(event) {
wixLocation.to (/CVOA-Member/${** [**wixUsers.currentUser.id**](http://wixusers.currentuser.id/) **}); }

It’s whatever that tiny section of URL is … i can’t really tell from your text … lol … i don’t see any spaces … but it’s one of those. …

Saved and Published. Still, after logging in and clicking Profile nothing happens…??
Here is the expanded wix code:

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;

$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w(“#button2”).label = “Logout”;
$w(“#button3”).show();
}
else {
$w(“#button2”).label = “Login”;
$w(“#button3”).hide();
}
} );

export function button2_onclick() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#button2”).label = “Login”;
$w(“#button3”).hide();
} );
}
// user is logged out
else {
let userId;
let userEmail;

// prompt the user to log in  
wixUsers.promptLogin( {"mode": "login"} ) 
  .then( (user) => { 
    userId = user.id; 
    return user.getEmail(); 
  } ) 
  .then( (email) => { 
    // check if there is an item for the user in the collection 
    userEmail = email; 
    return wixData.query("CVOA_Members") 
      .eq("_id", userId) 
      .find(); 
  } ) 
  .then( (results) => { 
    // if an item for the user is not found 
    if (results.items.length === 0) { 
      // create an item 
      const toInsert = { 
        "_id": userId, 
        "email": userEmail 
      }; 
      // add the item to the collection 
      wixData.insert("CVOA_Members", toInsert) 
        .catch( (err) => { 
          console.log(err); 
        } ); 
    } 
    // update buttons accordingly 
    $w("#button2").label = "Logout"; 
    $w("#button3").show(); 
  } ) 
  .catch( (err) => { 
    console.log(err); 
  } ); 

}
}

export function button3_onclick() {
wixLocation.to(/CVOA_Members/${wixUsers.currentUser.id});
}

The underscore does not go there … look at your URL settings when you setup that page … You either set it as: /CVOA-Members/{ID} … or something similar like that … that is what goes there …