• Resolved radview

    (@radview)


    Is is possible to modify the save/edit buttons to create multiple row submission forms?

    eg/ if the SQL db had NameID–JobID–Weekending–Date–Hours

    and We wanted a form to be Weekending–Name–Job–Mon–Tues–Wed–Thrus–Fri–Sat–Sun

    can we modify the form to allow the additional editalbe fields and then allowcate the form submission to post 7 rows of data back to the sql.

    Similar to the patch functionality in powerapps

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @radview

    Thank you for reaching out.

    You can add computed fields to a form and use them any way you like. Currently, hooks are only supported in the Table Builder, but they will be activated in the Form Builder soon as well. In fact, they are already available; they are just not yet activated. Hooks will give you more control and allow you to add additional actions to a form submission.

    Alternatively, you can use inline editing with the Table Builder. This feature just doesn’t work for inserts.

    What kind of functionality are you trying to achieve?

    Thanks,
    Peter

    Thread Starter radview

    (@radview)

    we have some forms we wish to build that the data gets used in multiple reports, but for the user entering the data would be easier to display in different ways,
    The timesheet example I used above is the simplest way I know how to explain what we are kind of trying to to.
    If I had my SQL table setup columns, Weekending, Name, Job, Date, Hours and we had multiple forms setup to enter daily, or weekly, or monthly but need the data per day for other reports.

    The daily form is easy its just the table and columns on a form new row for each different job worked on

    The weekly entry we would want to have Sun-Sat days listed as a input field ideally with the ability to add rows prior to submission for each job eg
    Weekending, Name, Job, Mon, Tues, Wed, Thrus, Fri, Sat, Sun (add row)
    Weekending, Name, Job, Mon, Tues, Wed, Thrus, Fri, Sat, Sun (add row)

    The form Submission would then be a loop of for all rows
    Weekending = Weekending, Name = Name, Job = Job, Mon = Date(Weekending – 7days)
    Weekending = Weekending, Name = Name, Job = Job, Tues = Date(Weekending – 6days)
    Weekending = Weekending, Name = Name, Job = Job, Wed = Date(Weekending – 5days) etc etc

    so that the form displays the weeks worth of items, but the stored data is a per date record.

    This maybe something well outside the bounds of what your plugin is meant to be doing and if so I apologies.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    This is an interesting use case. It reminds me of the attendance registration for the school administration system.

    WP Data Access does not support this kind of functionality out of the box, but you can achieve it using hooks. The Table Builder allows you to add your own buttons to the table header or footer and execute your own custom code to prepare your data.

    Globally, you have to follow these steps:

    • Create a data administration app for, let’s say, table weekly_submissions
    • Add a custom button to your table header using the customActionsTop hook
    • Call your own custom JavaScript function on button click (you can add your function to the global hook or load it from your own JavaScript file)
    • Write a custom REST API that creates the empty table rows for a specific period in table weekly_submissions
    • Call your REST API from your JavaScript function
    • Enable inline editing for all editable columns
    • When the button is clicked:
    • The REST API inserts the necessary table rows
    • The table is refreshed to show relevant rows
    • The user can edit the data directly in the table

    If you’re not in a hurry, I’m interested in solving this together, as I think this would be interesting for many other users as well. Maybe we can create a free, downloadable demo? Please use the contact page on the plugin website if you prefer to discuss this in private:

    https://wpdataaccess.com/contact/

    Here are some useful links:

    https://wpdataaccess.com/docs/table-hooks/app-level-hooks/
    https://wpdataaccess.com/docs/table-hooks/table-level-hooks/

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Form Customisations’ is closed to new replies.