Sign In Register

How can we help you today?

Start a new topic

Increment number of entries for a variable in a modal

Hello


I have a form in a modal that will allow users to add new entries into the metadata collection through the admin screen. Part of form will be generated from an array and users would just have to click a button to generate a blank entry in the array.


I am unsure how to increment the array using game sparks dynamic forms. I was writing a proof of concept using just an integer counter but the count is still staying at 0.  I call the action to increase the counter but nothing happens.


here is the html code that I am working with 

 

<gs-form snippet="add_new_chest_data?action=update" target="add_new_chest_data">
    <gs-title-block title="Add New Chest Data" padding="5">
        <h2>Count is {{chestData.entryCount}}</h2>
        <gs-row>
            <gs-col width="4">
                Name:
            </gs-col>
            <gs-col width="5">
                <input value="" type="text" required name="entryName" />
            </gs-col>
        </gs-row>
        <gs-row>
            <gs-col width="4">
                Time:
            </gs-col>
            <gs-col width="5">
                <input value="" type="text" required name="entryTime" />
            </gs-col>
        </gs-row>
        <gs-row>
            <gs-col width="4">
                Weight:
            </gs-col>
            <gs-col width="5">
                <input value="" type="text" required name="entryWeight" />
            </gs-col>
        </gs-row>
        <gs-row>
            <gs-col width="5">
                <h2>Hello</h2>
            </gs-col>
        </gs-row>
        <gs-row>
            <gs-link snippet="add_new_chest_data?action=addToCount&entryCount={{chestData.entryCount}}">
                <button>Add new</button>
            </gs-link>
        </gs-row>
    </gs-title-block>
</gs-form>

 

The javascript is pretty simple but I can add that if nothing is wrong with the code i posted.


Once again I am working in a popup modal and trying to increment a counter which will turn into an array once the counter increment is working. It seems like my function to update the count is not evening being fired when the button is clicked even though it should.


1 person has this question

Hi Justin,


Apologies for the delayed response. Are you still having issues with this ? Let me know and I'll get someone to review this for you if you are.


Regards,

Liam

sorry I forgot about this. No i am not having issues, this ticket has been solved.

Login to post a comment