Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Create Timesheet using Form App

I am trying to build a timesheet with multiple dates for the same person so that they can enter their 2 weeks worth of time. I have made a form however only one date. Very crucial in allowing one form to accept data for multiple dates as the user will have to create individual entries as well as the HR department will get emailed hundreds of times by each employee submitting timesheets all at the same time. Also, with single entries, all the timesheet emails will be mixed up and just a royal mess in the inbox of HR timesheets. Please advise. Thanks!

Comments

  • I would think a custom form would be needed for that, and that the big challenge isn't so much storing the entries as it is a UI challenge not cluttering up a page with that many fields.

    This may also help make it easier to add date widgets to your forms:

    https://www.elefantcms.com/helper/admin/util/datewidget

  • I will try that since you've suggested it, but I really need 2 weeks work on one entry and one email. I am thinking the custom form would work. What about page navigation? Can something like that work where the form has a "next entry" nav button so to speak that just basically displays the same thing again? I don't know how to do it...only know what I am needing.

  • That would still take making a custom form. But that would also give you more control over the layout so you can design it to be easier to read and use (breaking days up, or showing it in columns, for example).

  • I will try and read up the documentation and see if I can figure it out

  • Definitely not making any progress. Trying to follow along with the documentation to make a form but not working...at all.

  • Where do you think you're getting stuck?

    I usually start a form with the basic usage example (https://www.elefantcms.com/docs/2.0/developers/form-handling) and then just focus on the view template until I'm happy with that. I also often don't worry about input validation or writing the handling code until the template looks good.

    In the template, there's really only a few things you need:

    1. It needs to start with <form method="post" id="{{_form}}">
    2. It needs to end with </form>
    3. It needs a submit button

    From there, it's all about the fields you're adding to it and the layout.

    If you're using the basic usage handler code, when you submit the form it should print out all the fields you entered along with their values. That's handy for creating the database table since you can just create a column for each field.

    In your case, you'll want to break them up into separate entries by date, so you'll need to add some logic to show fields for the right date range and then afterwards to save them to entries for those dates. If that's where you're stuck, let me know and I can give some pointers there too. Here's a link with how to generate a list of dates in PHP between a start and end date:

    https://stackoverflow.com/questions/4312439/php-return-all-dates-between-two-dates-in-an-array

    Let me know and we can take it from there.

  • I am trying to put the whole thing together in my head so I can understand it better. I have no clue as to how to setup the form to have the multiple date entries.

  • How do you want me to show you what I have @jbroadway ?

  • If you have a Github account, this is a good option: https://gist.github.com/

    Otherwise, https://pastebin.com/ works too.

  • Check your inbox. Sent it yesterday. Will repost on pastebin. I definitely do have github

  • Apologies, been a crazy week but will try to put together an example for you this weekend.

  • No problem. I know you are busy and have work outside of this. Just hard for me because I am not a developer and I cannot seem to quite understand the scope. I really need to start with a Dummies book or something because I need to know what is that and what is this and integer and boolean and if else etc...I need to learn everything about programming.

  • Found a software package that will handle this for us. Disregard this topic. Thanks.

Sign In or Register to comment.