I am creating a website for a church. They publish their service on their website in pdf format every Sunday. I want to be able to display information that they put in their database on the live site at a set time each week.
I have put a job scheduler, as per my previous post, onto the site. So, the Job Scheduler is set to work at 09:00 on a Sunday.
I now need to know how I go about allowing them to put information into the database so that on a Sunday the repeater element automatically updates itself with any new information that has been added during the week.
Any help is greatly appreciated.
What kind of information is going into the database?
How will the data to get there?
How do you want the data to be displayed? Formatted?
I would start with a basic example first to understand how to the database will work.
Create a text box
User types in text to the text box
User clicks a button
Text is inserted into database
A different text block is connected to the database.
Reviewing this article first will likely help.
https://support.wix.com/en/article/displaying-database-content-on-a-regular-page
A very generic example below for inserting data from text box to database.
function button_click(event){
let newDatabaseEntry = {
‘info’ : $w( ‘#MyTextBox’ ).value,
}
wixData.insert( 'MyDatabase' , newDatabaseEntry );
}
So, what I am aiming to achieve is the following.
I have set up a repeater with an image, 2 text boxes and 2 buttons in the repeater. These elements are connected to a dataset.
What I want, is for the client to be able to input the information into the database themselves and for this to reflect on the website at a set time.
The time that I want this information to display is a Sunday at 09:00. However, they might upload it at any time during the week.
I have set up a Job Scheduler as you recommended, but I am struggling to work out how to set the database to automatically update when the Job Scheduler works.
I have a basic knowledge of coding, so am struggling a little.
@ntlovell10
What I want, is for the client to be able to input the information into the database themselves and for this to reflect on the website at a set time.
Modifying the database directly from website editor?
Entering into a user text field on a page? Private page?
Uploading some kind of document?
These are not necessarily questions I’m asking to you, but questions you should ask yourself as how you want it to function.
Like I said, I would suggest setting up basic functionality with the database first, before trying to get the scheduler working. User input to a text box to submit to database. Another text box linked to the database for display.
You need to get the input and display working manually before you start trying to automate it.
As far as the scheduler goes, it could be calling a function that does something such as:
function MySchedulerFunction( )
{
wixData.get( ‘MyDatabase’ , ‘123’ )
.then( result => {
result.info_live = result.info_pending;
result.info_pending = ‘’ ;
wixData.update( result );
})
}
Again, suggesting to test this manually before connecting to scheduler.
Where the ‘info_pending’ is where you input the data at any time, and ‘info_live’ is the column that is linked to the website display. In this example, I used a fixed database ID, as it seems you might only need 1 row in your database and just update it every week.
@derekmoorer Sorry, I’ve tried this but I’m getting no where.
The client will enter through the dashboard and alter the database from the content manager on the dashboard.
This database is connected to a repeater.
How do I set it so that the repeater will only update at a set time each week?