Maker Pro
Maker Pro

Why am I getting Javascript (form) or (this.form) errors?

D

Don Lancaster

Jan 1, 1970
0
In an existing, tested and working program, I have a form entry that
simplifies to...

<INPUT name ="fp1s" type="text" value=0.000 size=12 >

and a button of...

<input type="button" value=" Set Amplitude "
onclick="setAmplitude (this.form)">

One of the things the setAmplitude function does is calculate a p1s
value and then does a...

form.fp1s.value = p1s ;

This seems to work fine. I wanted to add a new feature to the program
by adding a new button of

<input type="button" value="Improve?" onclick="imProveX
(this.form)">

An initial function for imProveX was...

function imProveX (form) { setAmplitude (this.form) ;
} ;

This should be doing the same thing the other button does, except from
within a new proc instead of a button click. Instaad, an error of ...

'fp1s' is null or not an object

gets returned.

What am I doing wrong?

The full code appears as http://www.tinaja.com/demo28q.asp


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
M

MassiveProng

Jan 1, 1970
0
In an existing, tested and working program, I have a form entry that
simplifies to...

<INPUT name ="fp1s" type="text" value=0.000 size=12 >

and a button of...

<input type="button" value=" Set Amplitude "
onclick="setAmplitude (this.form)">

One of the things the setAmplitude function does is calculate a p1s
value and then does a...

form.fp1s.value = p1s ;

This seems to work fine. I wanted to add a new feature to the program
by adding a new button of

<input type="button" value="Improve?" onclick="imProveX
(this.form)">

An initial function for imProveX was...

function imProveX (form) { setAmplitude (this.form) ;
} ;

This should be doing the same thing the other button does, except from
within a new proc instead of a button click. Instaad, an error of ...

'fp1s' is null or not an object

gets returned.

What am I doing wrong?

The full code appears as http://www.tinaja.com/demo28q.asp


Depends on what version of java you have, and what you are developing
scripts under, and their co-compatibilities.
 
D

Don Lancaster

Jan 1, 1970
0
MassiveProng said:
Depends on what version of java you have, and what you are developing
scripts under, and their co-compatibilities.

JavaScript 1.1 being developed with Adobe GoLive 5.0.



--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
S

scripts.contact

Jan 1, 1970
0
here this refers to the imProveX function and there is no form
property for function. pass the argument to setAmplitude function and
all should be fine.

function imProveX (form) { setAmplitude (form) ;


Depends on what version of java you have, and what you are developing
scripts under, and their co-compatibilities.

??????????????
 
A

Andrew Holme

Jan 1, 1970
0
Don Lancaster said:
In an existing, tested and working program, I have a form entry that
simplifies to...

<INPUT name ="fp1s" type="text" value=0.000 size=12 >

and a button of...

<input type="button" value=" Set Amplitude "
onclick="setAmplitude (this.form)">

One of the things the setAmplitude function does is calculate a p1s value
and then does a...

form.fp1s.value = p1s ;

This seems to work fine. I wanted to add a new feature to the program
by adding a new button of

<input type="button" value="Improve?" onclick="imProveX
(this.form)">

An initial function for imProveX was...

function imProveX (form) { setAmplitude (this.form) ;
} ;

This should be doing the same thing the other button does, except from
within a new proc instead of a button click. Instaad, an error of ...

'fp1s' is null or not an object

gets returned.

What am I doing wrong?

The full code appears as http://www.tinaja.com/demo28q.asp


Try:

function imProveX (form) { setAmplitude (form) ; }
 
M

MassiveProng

Jan 1, 1970
0
JavaScript 1.1 being developed with Adobe GoLive 5.0.


Could also relate to the runtime engine you are trying to run it
under.
 
A

ASM

Jan 1, 1970
0
Don Lancaster a écrit :
<input type="button" value="Improve?" onclick="imProveX
(this.form)">

An initial function for imProveX was...

function imProveX (form) { setAmplitude (this.form) ;
} ;

function imProveX(form) { setAmplitude( form ); }
this.form is already here ------^
and was called in button

To avoid mistakes try to do not use variables named as elements

function imProveX ( something ) { setAmplitude( something ); }
or
function imProveX ( aForm ) { setAmplitude( aForm ); }
This should be doing the same thing the other button does, except from
within a new proc instead of a button click. Instaad, an error of ...

'fp1s' is null or not an object

it would have to be : 'form.p1s' is null or not an object
 
R

Randy Webb

Jan 1, 1970
0
MassiveProng said the following on 3/24/2007 12:05 PM:
The this above refers to the function and as such has no property named
"form". If you want to pass it, simply pass the parameter form.
Depends on what version of java you have, and what you are developing
scripts under, and their co-compatibilities.

Has nothing to do with any of that.
 
R

Randy Webb

Jan 1, 1970
0
MassiveProng said the following on 3/24/2007 12:34 PM:

Could also relate to the runtime engine you are trying to run it
under.

No, it relates to scope issues of variables and has nothing to do with
any "runtime engine"
 
R

Rich Grise

Jan 1, 1970
0
MassiveProng said the following on 3/24/2007 12:05 PM:

The this above refers to the function and as such has no property named
"form". If you want to pass it, simply pass the parameter form.


Has nothing to do with any of that.

I see MicroBrain is metastasizing. =:-O

Cheers!
Rich
 
M

MassiveProng

Jan 1, 1970
0
MassiveProng said the following on 3/24/2007 12:34 PM:



No, it relates to scope issues of variables and has nothing to do with
any "runtime engine"


We had problems at work after upgrading to a new version. Just
thought I'd mention it. No big deal.
 
R

Robert Baer

Jan 1, 1970
0
Don said:
JavaScript 1.1 being developed with Adobe GoLive 5.0.
There is a JavaScript NG and the posters there are *extremely* helpful.
 
R

RobG

Jan 1, 1970
0
here this refers to the imProveX function

No, it references the global object.

The only way imProveX's this keyword can refer to the imProveX
function is if the calling function had set it that way using call or
apply methods, and it doesn't. imProvex is called as a method of
window, effectively as window.imProvex(). Therefore its this keyword
references the window (global) object.

and there is no form
property for function.

for the global object (unless one has been created elsewhere).

pass the argument to setAmplitude function and
all should be fine.

function imProveX (form) { setAmplitude (form) ;

That should do it.
 
P

Paul Hovnanian P.E.

Jan 1, 1970
0
Don said:
In an existing, tested and working program, I have a form entry that
simplifies to...

<INPUT name ="fp1s" type="text" value=0.000 size=12 >

and a button of...

<input type="button" value=" Set Amplitude "
onclick="setAmplitude (this.form)">

One of the things the setAmplitude function does is calculate a p1s
value and then does a...

form.fp1s.value = p1s ;

This seems to work fine. I wanted to add a new feature to the program
by adding a new button of

<input type="button" value="Improve?" onclick="imProveX
(this.form)">

An initial function for imProveX was...

function (form) { setAmplitude (this.form) ;
} ;

Inside this function, 'this.form' is undefined. I think you need to pass
'form' to setAmplitude.
This should be doing the same thing the other button does, except from
within a new proc instead of a button click. Instaad, an error of ...

'fp1s' is null or not an object

gets returned.

Because its null (not defined in the calling function imProveX.
 
D

Don Lancaster

Jan 1, 1970
0
scripts.contact said:
Thanks for the info.

btw, randy said the same thing :)





Yup.. if you add the missing brace.

Many thanks to everyone. Using (form) rather than (this.form) did it.

Presently exploring how to get this code to converge faster.
Preferably instantly.
Any suggestions?

Latest working version is http://www.tinaja.com/demo28a.asp


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
M

Michael A. Terrell

Jan 1, 1970
0
Don said:
JavaScript 1.1 being developed with Adobe GoLive 5.0.


"Classic Wrong" doesn't know the difference between "Java"" and
"Javascript". :(


--
Service to my country? Been there, Done that, and I've got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
 
R

Randy Webb

Jan 1, 1970
0
Rich Grise said the following on 3/24/2007 5:25 PM:
I see MicroBrain is metastasizing. =:-O

I see c.l.j isn't the only group with an idiot. Are you related to VK by
chance? Genetics might explain it.
 
Top