Page 1 of 1

same fields two forms, enter data once?

Posted: Tue Dec 13, 2011 8:21 pm
by sx-74
Hey all,
I am making a contact form as well as an equipment rental form for an IOS app.
Both forms use the same information for some of the fields (name, email, phone) but are on different cards.
Can one field populate the other field, even on different cards?

Ex. "name" on card 1 populates "name" on card 6.

Thanks
- Jay

Re: same fields two forms, enter data once?

Posted: Tue Dec 13, 2011 8:29 pm
by jacque
Sure, use something like this:

Code: Select all

on preOpenCard -- in the second card
  repeat for each item i in "name,address,city,state" -- list fields here, no spaces
     put fld i of cd "firstcard" into fld i
  end repeat
end preOpenCard
That will update the fields just before the second card is opened. Or if you prefer, you can do it on a closefield in the first card so it's dynamically updated on the fly:

Code: Select all

on closeField
  put the short name of the target into tFld
  if tFld is among the items of "name,address,city,state" then
    put target into fld tFld of card "secondcard"
  end if
end closeField
Note the difference between "the target" (which is the field name) and "target" (which is the contents of the field.)

Re: same fields two forms, enter data once?

Posted: Wed Dec 14, 2011 7:59 pm
by sx-74
THANK YOU so much!
Very excited to try this.

- Jay

(15 minutes later)
Awesome! This works perfectly!
So excited.