Weekdays to Database

Is there a way to autopopulate the weekday in a database? Here’s what I’m doing…

Here’s the website code/set up…


Here’s how it looks in action!


I want to export that week day auto populated text to a database, though. Here’s the database…


Obvi, I want the week day to populate in the “weekdat” collumn.

Any direction/tips/etc?

I’ve tried backend code, front end code, and everything I can think of.

I think the best approach is to use the dataset onBeforeSave hook. In this hous code set the weekday field.

@yoav: I’m trying so hard to get this, but I’m pretty new to coding. Could you give me an example, please? I’m sorry that I need so much help here.

I’ve been spending a lot of time on this… there’s no “onBeforeSave” hook… and I don’t understand that second sentence at all. Please advise.

Caty, I’ve just tried this with a new form and it works fine. Please check:

  1. Verify that this field is ‘wired-up’ to the right field on the dataset
  2. Try to input some arbitrary value in the field and submit, and see if it does save then

Uri, thanks a ton! So, when I connect the field to the data-set, it goes blank on the form and in the database collection. I’ll disconnect and reconnect everything.

Ok… So here’s what happened…

  1. It’s wired up properly.
  2. So, I disconnect the textbox (with the autopopulate day of week code) from the dataset, it stops going blank on preview. When I reconnect it to the dataset and preview (and submit the form) it submits a blank field value under the “weekday” field. Everything else populates fine.
  3. I then disconnected the original textbox, created a new (codeless) text box, typed some “blah blahs” and hooked it up to the data-set. Upon submit, the field was blank.

The only thing I can think of is that MAYBE there’s something fishy with the field. I have the code right, and it should show Sunday, Monday, Tuesday… (yadda yadda yadda.)

Any input would be much appreciated.

Did it! Thanks Uri! It took a few days, but it’s good now!