Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert Gillman 7 posts 78 karma points
    Dec 05, 2016 @ 02:50
    Robert Gillman
    0

    Accessing grid editor data attribute within form

    The basic setup is as follows:

    • The grid editor has a download link with a data attribute for a file id that opens a form in a lightbox
    • The layout renders the lightbox form with a hidden field for the file id
    • When the lightbox plugin is initialised, the hidden field is populated with the file id from the data attribute via jQuery
    • When the form is submitted, the file url is retrieved using the file id and inserted as the href of a button in the on submit message and a cookie is set

    If the user visits the page again, or any page with this grid editor, and clicks the download link, they will be presented with the download button (on submit message) due to the cookie being set. However, the button no longer has the url for the file as it was being accessed from a hidden field in the form, which is no longer rendered.

    I need a way to access this file id in the form view if the cookie is set, and the file id will change based on which page the user is on.

    I'm not quite sure if I should be trying to access the grid editor model, or populating a hidden field in the layout, I'm really drawing a blank.

Please Sign in or register to post replies

Write your reply to:

Draft