Hello Wix team,
Is it possible to programatically change the read/write access of a dataset? The problem I am facing is this:
I have a user input collecting form and another page that displays a table with the data collected. I have also a dynamic page which displays the information submitted by the user one by one from the database. In the dynamic page I have am planning to add a edit button that redirects the user to the same form and loads the content in the form so that he can edit and save it.
So the form need to be in write mode when a new data is added into it and in read/write mode when it is being edited.
I tried using read/write mode for both cases. But then the user input elements in the form is stuck/disabled for the first input I add (as there is nothing to read from the database at that time). and the table always crashes at this time.
So I think it will work if i set the database in to write mode during addition of new data and to read/write mode when I need to edit something. Is this possible programmatically using wix code? Thanks
Hi,
You don’t have to change the mode.
If you want to create a new record instead if editing an existing one, you can call the dataset “new” function. This is actually what the write mode does internally.
Will that work for your use case?
Thanks for your reply.
But I am already using new() in my on ready function of the dataset inside the on render function of the form page.
But somehow I am not able to enter anything in to the form first time… If I enter anything manually into the live dataset and then reload the form, everything works as expected… But then there will be a dummy entry in the table that does nothing…
If you’re using “new” but the input elements are still disabled, it is a bug.
Can you share your site with a reproduction of this case so we can take a look?
Hello Tomer,
Sorry for the late reply. Here is the link to the website with no content in the database.(I deleted the contents to recreate the error) https://www.indianexpatshub.com/housesearch
You can click on create and then on offer to fill the first page in the slide show to see the error. All the elements from second slid show is disabled if the database is empty(even when new command is used). To prevent this from happening, i need to enter a dummy entry to the database. Then all other entries will work properly. Please have a look into the issue and please help me to solve this issue
גם אצלי אותה בעיה. או שהדאטא מוגדר ומקבל את התוכן מהטופס, או שהוא נסגר לתוכן חדש ומאפשר תצוגה של הנתונים. לא הצלחתי להפעיל עם read&write, זה קורס.
תודה!