instantiate form with default values

Discussion in 'Cadence' started by SS, Apr 5, 2006.

  1. SS

    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
     
    SS, Apr 5, 2006
    #1
  2. 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.
     
    Andrew Beckett, Apr 5, 2006
    #2
  3. SS

    S. Badel Guest

    I have a form "myform" and the form field myformfield is a field
    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
     
    S. Badel, Apr 6, 2006
    #3
  4. SS

    SS Guest

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

    thanks,
    Sriram
     
    SS, Apr 6, 2006
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.