1

For a project in my uni, I wanted to build a website that contained 200 messages and make it so that users can modify those messages, and then any other user who looks at the site would be able to see the modified messages and modify messages themselves. There would be exactly 200 messages, and the only way to make a new one is to override an existing one.

I've got all the user interface stuff functional and I've been tinkering with using the Google Sheets API to accomplish the string storage since it will handle JS arrays, but it doesn't seem to really be built for this type of use case.

If it would be possible to store the messages as strings (maybe in an array) in a document on the server and be able to use the javascript to make permanent adjustments to the strings in that document it would be amazing but I can't seem to find any sort of documentation on how to do something like that. Does anyone know of any methods to approach a problem like this using JS and Jquery? Or know of an API they can recommend would be amazing.

Basically what I have already is a system that would call up the complete list of messages and store that as an array of strings.

var messagesIndex = (some sort of get function);

Then the user can select a message, and modify it, at which point the locally stored array is updated. active = "(this is just here to make it a global var, it's just an index of which message I want from the array of messages)"

    $(function() { $("button").click(function() { 
            active = this.id;
            update();
        });
    });

    function update(){
        //sets the message inside the message display box to the correct message, where it can be altered
        $("#message").messagesIndex[active]);
        //some other stuff here that isnt relevent to this question.
    }

and then the java would send that updated set of strings which would permanently override it in that storage doc. At least that would be my ideal situation.

  • What you're asking for is pretty straightforward, but consider how you'd stop somebody deleting all the messages, or vandalising them. If this is anything more than a lab project you need include some security. –  May 26 '19 at 01:39
  • This is just a small private access project that only my classmates will have the ability to see, so I'm not super worried about that, but I do plan to try and implement a system to prevent curse words if I have the time. – Drew Mattice May 26 '19 at 01:55
  • Google forms feeding Google sheets seems like a fine idea. Nothing wrong with it unless you are looking to enhance you webdev skillset with this project. – Randy Casburn May 26 '19 at 02:10
  • Randy's suggestion is a good one, but if you want to know what's involved in doing this as a webpage, see [this other question](https://stackoverflow.com/questions/56309309/how-to-create-an-adjustable-dropdown-form/56309840#56309840) – cssyphus May 26 '19 at 02:17

0 Answers0