Jump to content

Pages - including JS code

Recommended Posts

As it appears that it's not possible to have a computed field in a database (ie a field whose value is calculated based on other fields in the record) so I'm having to look at alternatives.

"You could just calculate the value when displaying the record" I hear you say....yes, and it works fine. But I'd like to be able to allow people to sort the record table on these calculated fields.

So....option available: use JS on the form which will re-calculate a field when one of the other fields changes. Nice and easy.

Problem: included JS in a page doesn't get included when editing a record. I've included a little alert("test"); in a page, and it fires when viewing the record listing, and when viewing the record. But when you edit the record, it doesn't fire.

Is include JS supposed to work like that?

Link to comment
Share on other sites

  • 3 weeks later...

You may need to include the js on the record form templates.

ACP - Pages - Templates - Add Template - Choose Database - and then from the drop-down for type the last one is Record Form which handles record entry and editing.

Plonk it in there somewhere and if it works, great. If not maybe it helps to narrow down the problem. Otherwise sticking it somewhere in the global template as you already figured out gets the job done.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...