kevind
Posts: 251
|
| Posted: 09/27/2005, 7:58 AM |
|
Hi all,
I'd like to have 1 calculation occur whenever a given record is updated or inserted - this is in a form.
Can I put the code in the On Validate section or do I have to repeat it in Before update AND Before Insert ??
thanx,
Kevin
_________________
thanks
Kevin
======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 09/27/2005, 8:12 AM |
|
You can do it in more way than one.
You can do it on validate, but if you are altering data and the validation
results in errors you may end up having a problem.
What I do is create a function at the bottom of the*_events.asp page, and
call it on the before insert and before updates. That way I amintain the
code only in one place.
"kevind" <kevind@forum.codecharge> wrote in message
news:643395e267097d@news.codecharge.com...
> Hi all,
>
> I'd like to have 1 calculation occur whenever a given record is updated or
> inserted - this is in a form.
>
> Can I put the code in the On Validate section or do I have to
repeat
> it in Before update AND Before Insert ??
>
> thanx,
> Kevin
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
kevind
Posts: 251
|
| Posted: 09/27/2005, 8:19 AM |
|
ok, so you're saying open mypage_events.asp and create a function there ?
How do I call it - I want it to act on more than control in the form being submitted.
thanks,
kd
_________________
thanks
Kevin
======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
|
 |
 |
kevind
Posts: 251
|
| Posted: 09/27/2005, 10:40 AM |
|
NEVER MIND - I got it.
Too bad it doesn't show up in the project browsing panel, guess you just have to make notes of any custom functions.
thanks,
kd
_________________
thanks
Kevin
======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
|
 |
 |
DonB
|
| Posted: 09/27/2005, 11:22 AM |
|
You can put the code into the Before Update and call the Before Update
function from the Before Insert function, although I like the approach
Benjamin outlined - a separately written function. Although I normally add
an 'include' to the main code page (like the one you see there form
Common.asp) and put all my custom functions there, instead of scattered
about in *_events.asp files.
--
DonB
http://www.gotodon.com/ccbth
"kevind" <kevind@forum.codecharge> wrote in message
news:6433962ffc399c@news.codecharge.com...
> ok, so you're saying open mypage_events.asp and create a function there ?
>
> How do I call it - I want it to act on more than control in the form being
> submitted.
>
> thanks,
> kd
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
kevind
Posts: 251
|
| Posted: 09/27/2005, 11:30 AM |
|
so, create my own .asp file with called MyFunctions.asp or something like that and then where do I stick the include - is it the include through CCS or do I have to use an ASP include hand coded.
BTW - I don't mind having this function 'scattered' as it belongs only to the fields in this particular record form - it's not re-usable (this time).
thanks,
kd
_________________
thanks
Kevin
======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
|
 |
 |
DonB
|
| Posted: 09/27/2005, 11:44 AM |
|
I use something like "library.functions.asp" so I know that CCS will never
create a filename that clobbers mine. I include it in the main code exactly
the same way Common.asp is included - a simple 'asp' include, not CCS
Include object.
--
DonB
http://www.gotodon.com/ccbth
"kevind" <kevind@forum.codecharge> wrote in message
news:643398fc7d23fb@news.codecharge.com...
> so, create my own .asp file with called MyFunctions.asp or something like
that
> and then where do I stick the include - is it the include through CCS or
do I
> have to use an ASP include hand coded.
>
> BTW - I don't mind having this function 'scattered' as it belongs only to
the
> fields in this particular record form - it's not re-usable (this time).
>
> thanks,
> kd
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
kevind
Posts: 251
|
| Posted: 09/27/2005, 12:50 PM |
|
ok, great, how do i do this include - where does it get place in the project ?
do I need to manually edit each page and touch up the includes at the top of the code or, can it be put in one place and CCS takes care of including it ?
thanks,
kd
_________________
thanks
Kevin
======================
CCS 3.2.x / ASP / MS Access /mySQL / PHP / jQuery / jQuery UI / jQuery Mobile
|
 |
 |
DonB
|
| Posted: 09/27/2005, 3:08 PM |
|
It works, looks and is used exactly like Common.Asp, only it doesn't show up
in the Project tree unless you switch to the 'Files" tab.
If it's functions are widely useful, put an include in Common.Asp itself and
all pages load it. Otherwise put it into specific pages. Just follow the
example of Common.Asp.
--
DonB
http://www.gotodon.com/ccbth
"kevind" <kevind@forum.codecharge> wrote in message
news:64339a29713d50@news.codecharge.com...
> ok, great, how do i do this include - where does it get place in the
project ?
>
> do I need to manually edit each page and touch up the includes at the top
of
> the code or, can it be put in one place and CCS takes care of including it
?
>
> thanks,
> kd
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Benjamin Krajmalnik
|
| Posted: 09/28/2005, 10:30 AM |
|
Don,
If a function is specific to only one page, I write it in the *_events.asp.
If it is a general utility function, then it goes as an include in Common.
That way, I don't bload common with functions which may bot be called 90% of
the time.
|
|
|
 |
|