Home > Community > Forums > Custom IC SKILL > Dynamically update a form


* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Dynamically update a form 

Last post Wed, Feb 27 2013 10:05 AM by thomas1000. 2 replies.
Started by thomas1000 26 Feb 2013 01:38 PM. Topic has 2 replies and 746 views
Page 1 of 1 (3 items)
Sort Posts:
  • Tue, Feb 26 2013 1:38 PM

    Dynamically update a form Reply

    I am trying to dynamically update a form so that when you enter text into one text box other things on the form, like other text boxes change.  This is such a common thing to want to do it seems like it ought to be easy but for some reason I haven't found the solution  I tried things like 

    set(car(TheForm->fieldList) "Test")

    Here TheForm was a variable set to the form ID.  I got the field list because in my form I have a variable number of fields and don't necessarily know the ID of each field.  In this example I was just trying to set the first text box field on the form to "Test".  That didn't work - the CIW echoed "Test" but the form didn't update.

    Can anyone help show me how to update a form dynamically so that when one text field is changed by the user, another text field has its value changed?

    Filed under:
    • Post Points: 20
  • Wed, Feb 27 2013 12:23 AM

    Re: Dynamically update a form Reply

    You'd need to do:

    get(TheForm car(TheForm->fieldList))->value="Test"

    If you just do car(TheForm->fieldList), you'll get the symbol which is the name of the field. What you were doing was setting a property on the symbol, not on the form field. So what I'm doing is getting the the form field structure itself, and then updating the value.

    Note I would generally recommend against using fieldList - that's all very well until you then add a button or something else onto the form. Better would be to ensure that your fields are named deterministically by using something like concat('CLfieldThing count++) rather than gensym, and then record the number of fields on the form using TheForm->myFieldCount=count, or  record the fields that you generate using TheForm->myFields=listOfFields. Note you can add whatever properties you like on the form data structure, so it's useful to store related information.



    • Post Points: 20
  • Wed, Feb 27 2013 10:05 AM

    Re: Dynamically update a form Reply

    Thanks, Andrew,

    That works well.  A very helpful response.

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by thomas1000 at 26 Feb 2013 01:38 PM. Topic has 2 replies.