unable to get form field values

Guest
I have defined a form(say myForm), & bringing it up by loading in CIW
Then I enter values for different fields

But when I try :-

foreach( f myForm->fieldList
printf( "value of %L is %L\n", f f->value)
)


Values of all the fields are showing up as nil But if I type in
fieldName->value in CIW , it shows my entered values
I tried hiGetCurrentForm()->fieldList but that doesn't help either


Pl. advise
 
piyush72@gmail.com wrote, on 04/30/09 11:18:
I have defined a form(say myForm), & bringing it up by loading in CIW
Then I enter values for different fields

But when I try :-

foreach( f myForm->fieldList
printf( "value of %L is %L\n", f f->value)
)


Values of all the fields are showing up as nil But if I type in
fieldName->value in CIW , it shows my entered values
I tried hiGetCurrentForm()->fieldList but that doesn't help either


Pl. advise
foreach(f myForm->fieldList
printf( "value of %L is %L\n" f get(myForm f)->value)
)

In your case f is just the name of the field, and so to get the form field, you
need to get from the form to the field itself (which is what the get(myForm f)
is doing in my case).

Regards,

Andrew.
 
In article <49f99f83$1@news.cadence.com> Andrew Beckett <andrewb@DcEaLdEeTnEcTe.HcIoSm> writes:
piyush72@gmail.com wrote, on 04/30/09 11:18:
I have defined a form(say myForm), & bringing it up by loading in CIW
Then I enter values for different fields

But when I try :-

foreach( f myForm->fieldList
printf( "value of %L is %L\n", f f->value)
)


Values of all the fields are showing up as nil But if I type in
fieldName->value in CIW , it shows my entered values
I tried hiGetCurrentForm()->fieldList but that doesn't help either


Pl. advise

foreach(f myForm->fieldList
printf( "value of %L is %L\n" f get(myForm f)->value)
)

In your case f is just the name of the field, and so to get the form field, you
need to get from the form to the field itself (which is what the get(myForm f)
is doing in my case).
Also note that fieldName->value and myForm->fieldName->value (or
"get(myForm f)->value" which is the same thing) will give you different
results in many cases.

fieldName->value will dereference the field defstruct (assuming that you
assigned the return value of hiCreate*Field to the symbol fieldName) which is
the prototype for creating the field widget), where myForm->fieldName->value
will dereference the actual value of the form's field.

In some cases the independent field defstruct and the form's field will have
the same value, but it is not reliable.

-Pete Zakel
(phz@seeheader.nospam)

"The more things change, the more they stay insane."
 
Pete nospam Zakel wrote, on 04/30/09 20:51:
Also note that fieldName->value and myForm->fieldName->value (or
"get(myForm f)->value" which is the same thing) will give you different
results in many cases.

fieldName->value will dereference the field defstruct (assuming that you
assigned the return value of hiCreate*Field to the symbol fieldName) which is
the prototype for creating the field widget), where myForm->fieldName->value
will dereference the actual value of the form's field.

In some cases the independent field defstruct and the form's field will have
the same value, but it is not reliable.

-Pete Zakel
(phz@seeheader.nospam)

"The more things change, the more they stay insane."
And to clarify what Pete said a bit, fieldName->value would only work anyway if
you'd got the field defstruct stored in a variable called fieldName. Even then
it would not tell you the value of the field on the form, because you need to
get to the instance of the destruct by accessing it from form->fieldName or
get(form 'fieldName).

Actually that may not have clarified it that much, reading through what I said.
Hoh hum ;-)

Regards,

Andrew.
 

Welcome to EDABoard.com

Sponsor

Back
Top