instantiate form with default values

S

SS

Guest
How do I set instantiate a form with default values without displaying
the form?

I have a form "myform" and the form field myformfield is a field
inside myform.
the default value of myformfield is set to '0'.

However the form "myform" does not get instantiated after the code is
loaded. If I try to explicitly specify the value of
myform~>myformfield~>value = something. I get an error unknown vairable
- myform

Unless I run the code to display the form, "myform" is not
instantiated. Is there a way that I can instantiate the myform without
the form being displayed.


thanks,
Sriram
 
On 5 Apr 2006 08:34:00 -0700, "SS" <ssriramiyer@gmail.com> wrote:

How do I set instantiate a form with default values without displaying
the form?

I have a form "myform" and the form field myformfield is a field
inside myform.
the default value of myformfield is set to '0'.

However the form "myform" does not get instantiated after the code is
loaded. If I try to explicitly specify the value of
myform~>myformfield~>value = something. I get an error unknown vairable
- myform

Unless I run the code to display the form, "myform" is not
instantiated. Is there a way that I can instantiate the myform without
the form being displayed.


thanks,
Sriram
Sriram,

It sounds as if you're not actually calling hiCreateAppForm() if you're getting
an unbound variable error. Alternatively, perhaps you made the variable that is
used to store the form a local variable (by putting it in a let statement). You
should NOT do that. In general top level user interface things (forms, menus)
should be stored in global variables (there are ways around this if you're
relying on the blocking nature of the form, and are displaying it in the same
function it's created, but in general the variable should be global).

It is in some cases necessary to "instantiate" the form by using
hiInstantiateForm(), but that's going to be of no use unless you have the form
data structure available - i.e. the issue I described above has been resolved.

Andrew.
 
I have a form "myform" and the form field myformfield is a field
inside myform.
the default value of myformfield is set to '0'.
A wild guess...

How about setting the ?value option too, when creating the field ?

i.e. during the call to hiCreateXXXField.

Note, the correct might be something else than ?value for some types of
fields, but for most it is ?value.

Stéphane
 
Andrew,
I had set the variable as local.
changed it to global and it works.

thanks,
Sriram
 

Welcome to EDABoard.com

Sponsor

Back
Top