Hey all, a little new here. I’m trying to start a website for a small school I’m working in. How do I go about creating a website where parents can sign up and view their children’s grades privately. So far I have added a Members area where parents can sign up but that’s about it. Thanks.
You can add a dynamic page
Add a repeater or table
Then add an eq query
Check if the current user Id matches that of in the grade database
Assign the result to the repeater or table
If you need more details or examples you can just post here
Because, I have done the same before !!!
Hi Kumar! Could you share your work? And also, please give all the details. Thank you.
A School Grade-Viewing System can be easily achieved by doing the following
→
(Tip → This is not a tutorial, just sharing my view)
Requirements →
- A Dynamic Page.
- 2 Databases .
- A registration setup →
→ For a registration setup
→ An input for Name.
→ An input for class and division or a dropdown (only if needed).
→ An input for email.
→ An input for password.
- A Table or Repeater .
That’s all!
(Tip → This is not a tutorial, just sharing my view)
- For registration setup. (as told above) we need a
→ An input for Name.
→ An input for class and division or a dropdown (only if needed).
→ An input for email.
→ An input for password.
Create a database for storing the Student’s information.
Code for the registration page →
import wixData from'wix-data';
import wixUsers from'wix-users';
$w.onReady(function () {
$w('#submitButton').onClick( (event) => { // submit button
let email = $w('#emailInput').value; // email input
let password = $w('#passwordInput').value; // password input
// the (below) code registers the user
wixUsers.register(email, password)
.then( (result) => {
let user = wixUsers.currentUser;
let userId1 = user.id;
// the (below) code ,after registration, inserts the name, class, userId etc to database.
let toInsert = {
"name": $w('#nameInput').value, // id of the field where the name of students or parents store and name input.
"class": $w('#classInput').value, //id of the field where the class of students store and class input.
"userId": userId1
};
wixData.insert("CollectionName", toInsert) // Database name
.then( (results) => {
console.log("User registered");
});
});
});
});
(Tip → This is not a tutorial, just sharing my view)
- For login setup →
→ An input for email.
→ An input for password.
Login page code->
import wixUsers from'wix-users';
import wixLocation from'wix-location';
$w.onReady(function () {
$w('#submitButton').onClick( (event) => {
let email = $w('#emailInput').value; // email input
let password = $w('#passwordInput').value;
wixUsers.login(email, password)
.then( () => {
console.log("User logged in");
wixLocation.to(`/page`); // navigate user to dynamic page
});
});
});
(Tip → This is not a tutorial, just sharing my view)
In the Dynamic page (profile of student)
we need a table or repeater.
(Datasbase-> For the database of grade we need the fields for grade and an additional field for userId of students)
Dynamic page code->
import wixData from'wix-data';
import wixUsers from 'wix-users';
$w.onReady(function () {
let user = wixUsers.currentUser;
let userId1 = user.id;
wixData.query("myCollection") // database of grade
.eq("userId", userId1)
.find()
.then( (results) => {
if(results.items.length > 0) {
let items = results.items;
//if it is repeater, connect the repeater to the respective dataset then add the following code
$w('#myRepeater').data = items;
// if it is a table then check the link below
} else {
console.log("No result found!!!");
}
} )
});
Table → https://www.wix.com/corvid/reference/$w/table/rows
https://www.wix.com/corvid/reference/$w/table/columns
Hi, i’m making a school-grade viewing system… All of Your codes works but can i create another database with only 2 fields (User grade, userId)?.. I Want to use another database for the school grades and another one only for users info…
Please help me!