Skip to main content
10 events
when toggle format what by license comment
Nov 11, 2021 at 15:57 comment added Djave Hey @shadi, thanks for the advice on the Edit function. I think we were talking about two different things, but your tip on setting everything in there (no logic in save) was able to help me do what I needed to and I have answered my own question.
Nov 10, 2021 at 19:10 comment added shadi These questions are created in edit.js, right? I mean, these questions and answers are created in editor. If that is so. In the process of creating these blocks, why don't u save the indexes in the attributes of the quiz block and then pass them to save.js.
Nov 10, 2021 at 18:59 comment added Djave I would like to save a question name like "Question 1." "Question 2." "Question 3." using the questions' index. And I would like to use the question index and the answer index to give some checkboxes unique ids, so question 1 answer 1 would be <input type="checkbox" id="q1-a1"/> and answer 2 would be <input type="checkbox" id="q1-a2"/> etc. Thanks for trying to help
Nov 10, 2021 at 18:55 comment added shadi Maybe I did not understand your question right. Why do want to get the index of innerblocks in save.js, what would you do with these indexes?
Nov 10, 2021 at 18:46 comment added shadi Let me know if that worked for you.
Nov 10, 2021 at 18:46 comment added shadi But usually when you want to add some functionality to your save.js, you use vanilla js in the traditional way. Not through react. Though, it is possible to use React in the frontend. But that is a different topic.
Nov 10, 2021 at 18:41 comment added shadi If you want more help, and exactly how to do it. i need to see all your code. edit.js and save.js....
Nov 10, 2021 at 18:38 comment added shadi save.js most not contain any logic. As I told, you use vanllia js in another file. And use document.querySelector to grap the element, then get its data attribute using element.getAttribute("data-index").
Nov 10, 2021 at 18:34 comment added Djave How would I get those values?
Nov 10, 2021 at 18:31 history answered shadi CC BY-SA 4.0