Form without using Make Answered

Post author
Marko Guzvic

Is it possible to make a form that adds a Memberstack plan and removes "credits"(which would be a custom field) when submitted? Natively with Memberstack without using MAKE. I'm using MAKE for these things right now, but I'm sure it would be quicker and safer doing it the way I described, if possible of course,

Comments

1 comment

  • Comment author
    Duncan Hamra

    Hey Marko 👋 I bet you could do something like this with custom code and the DOM Package.

    I asked Reybot and she agrees:

    Creating a form that adds a Memberstack plan and modifies a custom field (like "credits") upon submission, without using external tools like MAKE, is indeed possible by leveraging the Memberstack DOM package. This approach allows for direct interaction with Memberstack functionalities, including member management and custom field manipulation, directly from your website's frontend.

    Steps to Implement Your Requirement:

    • Fetch the Currently Logged-in Member's Data: To modify a member's custom field or assign a plan, you first need to identify the currently logged-in member. Use the Memberstack DOM package to fetch this data.
    const member = await memberstack.getCurrentMember();
    console.log(member.id);
    console.log(member.customFields);

    Update Custom Fields (Credits): Once you have the member's data, you can proceed to update the custom field (e.g., "credits"). Assuming "credits" is a custom field you've set up in Memberstack, you can decrement it as needed.

    const updatedCredits = member.customFields.credits - 1; // Assuming you're deducting 1 credit
    const customFields = { credits: updatedCredits };
    await memberstack.updateMember({ customFields });

    Considerations:

    • Ensure that the form submission triggers the above JavaScript code. This might involve adding an event listener to your form or using a form submission handler.
    • The custom field (e.g., "credits") must be predefined in your Memberstack dashboard.

    Additional Resources:

    • Member Management with the Memberstack DOM Package: For more details on managing members and custom fields.
    • Setting up a profile form in Webflow: If you're using Webflow and wish to update custom fields through a profile form.

    This approach allows you to directly integrate the functionality into your site, offering a quicker and potentially safer method than using external automation tools like MAKE. However, ensure to test thoroughly to confirm the behavior aligns with your expectations.

    This advice isn't exactly what you're looking for... but hopefully it will get you going in the right direction. if you define exactly how the code should work and tell Rey, she can write the scripts for you

    0

Please sign in to leave a comment.