Dynamic pages with unique forms

Would it be possible to have all my members, with their dynamic profile pages, submit a form to enter their own database?

Thank you!

Hi,

It is not possible to create a collection dynamically, however you can submit form data and place it as as object inside a collection record. You can achieve that by writing code.
Read the form and place the information inside an object, and add this object to a field in the toUpdate object, then update the collection with the form information.

I have made a code skeleton below:


import wixData from 'wix-data';


export function submit_click() {
	//find the user's ID by querying the email with wixData query
	//wixData.query('members')....
	
	const userId = 'id result from query';	

	//obtain the info from the form
	const name = $w('#nameInput').value;
	const number = $w('#numberInput').value;
	// add more fields here

	//construct the item 
	
	let formObject = {
		"name": name,
		"number": number
		//add more fields here
	};
	
	
	let toUpdate = {
		"_id": userId,
		"formSubmissionResult": formObject
		//add more fields here

	};
	
	
	wixData.update("members", toUpdate)
	.then( () => {
		//update complete
	} )
	.catch( (err) => {
		let errorMsg = err;
	} );
	
	
}

Good luck

What needs to be added to make a field entry required? Thanks.

‘Required’ form field attribute apparently doesn’t work with dynamic pages; why I need help. Who knew! Thanks.

@admin-23 I was brought here by a Wix representative, I have a problem similar to the one you helped with here that I was hoping you would take a second to check out. Below is the link to the post or I think the post lives on my profile as well.

Would really appreciate it if you had a second to check out my post and see if you have a few tips for me.

Best,
Parker

I’m happy to help if I can. I haven’t revisited this in some time. Assuming you’re collecting the form submission into a database, my first impulses would be:

  1. Sending a different form based on the location

  2. Create a location field for form record (Nashville, etc). This could be hidden to the User and prepopulated as part of each location form; or, the city name displayed to the Userr could be an echo of the location field.

In other words, if the User is seeing a unique location displayed, that could be the identified field embedded in their form record submission.
Perhaps it’s more complex and I’m not yet seeing that?
Kind regards,
David

1 Like