Form entry

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Wed Jan 29, 2014 8:36 pm

I am not following how the 2nd stack will work with the main stack. Would it be easier to put all the fields on all the cards. Is there a way to fill in the fields with the same name on the other cards with the same information for that 1st card?

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Wed Jan 29, 2014 8:42 pm

I think I am getting lost with the 2nd stack. I don't understand how the 2nd stack will work with the 1st stack. I understand how the experiment script will work and I can expand the script to other options. Also, I can put the fields on the card where I want.

May biggest issue is that I get myself confused in what I am trying to do.

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Wed Jan 29, 2014 9:41 pm

I think I sort of get it what you are explaining. I had to read it several times for it to click. The 2nd main stack is for creating the main menu for the 1st stack. Is that correct?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Form entry

Post by dunbarx » Wed Jan 29, 2014 9:46 pm

Mark.

No.

You will work with one stack only. That stack will contain a card for the main menu, and also the cards for the form to fill. When that is complete, then we will talk about a second stack that will make your standalone able to be saved. That is for later, and has nothing to do with the work we are doing now.

So, again, one stack for now. All your functionality will go there. All future questions should now focus on making the application work the way you want it.

Craig

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Wed Jan 29, 2014 11:10 pm

I have my main stack as far as I can get. I think I am going to put the fields on each card. Each card will have the same fields. Is there a way to put the same information (user input) into all the field with the same name on the corresponding cards.

Example:

Each card will have a field named "first Name" and a field named "last Name" when the user inputs their first and last name it will populate each card in the corresponding field.

I also, want to select the cards it will go on. say cards 1-3 or 1 and 3. Is there a way to do this?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Form entry

Post by dunbarx » Wed Jan 29, 2014 11:48 pm

All you want to do is very straightforward.

You can, and should, preload those cards. It is simple to take the information in those fields and share them with the other fields. But you MUST first learn the basics of LC. That said, this is a good first project. Please be patient, as nobody here will author this stack for you, and you must learn as you go.

You should add navigation tools to this stack, as well as play around with the scripts of the main stack buttons. I suggested using an option menu there, but that is a matter of style. Write back when you can place fields on several cards. Don't forget labels for those fields, and a way to terminate the data entry process which will populate the specific fields on certain other cards of your choosing. This effort cannot be shortened. It will take you a little while. Keep at it.

Craig

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Tue Feb 04, 2014 7:32 pm

Ok I have my stack setup the way I want to. I want to enter text in multiple fields on different cards. I have no idea how to accomplish this. Any help would be appreciated.

Thanks

Mark

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Form entry

Post by dunbarx » Tue Feb 04, 2014 8:17 pm

I assume you have references to those fields on other cards, right? (PseudoCode):

put yourData into field fieldReference of card cardReference --you can even add "of stack stackReference"

Like:

put "xyz" into field "names" of card 4
put "xyz" into field "addresses" of card 4
put "xyz" into field "phone" of card 4

Try this kind of thing in a test button. Experiment. This is powerful, but very basic stuff. You have to learn to drive comfortably. Don't think for a minute you can rush this, or just jump in and make applications. You will soon, but not quite yet. Did I mention you must experiment a lot?

Craig

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Tue Feb 04, 2014 8:25 pm

Where I get hung up on is what a user can do compared to what I can do. I want the user to be able to put text into the same field on different cards.

For Example:

put John into Field "name" on card 1 and card 2
Put Tim into field "Name" on card 1-5

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Form entry

Post by dunbarx » Tue Feb 04, 2014 8:46 pm

OK.

In one of your experiments, which you are about to start and continue for a while, make a button. You already should have fields on several cards. Each "put" in this sort of usage has to be run for each field of interest. There are ways to streamline text references as you wrote, like "line 1 to 5 of fld whatever, but that is quite another story. So:

put "John" into Field "name" of card 1 --ALWAYS quote literals
put "John" into Field "name" of card 2 --you use "on". I use "of". Your choice.

Put "Tim" into field "Name" of card 1
Put "Tim" into field "Name" of card 2
Put "Tim" into field "Name" of card 3
Put "Tim" into field "Name" of card 4
Put "Tim" into field "Name" of card 5

I have not given homework in a while. Yours is to condense that second group using a "repeat" loop. Take your time...

Craig

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Tue Feb 04, 2014 9:15 pm

Is this close?

Code: Select all


on mouseUp
  if field "name" is not empty then
   exit mouseUp
  end if

repeat with x = 1 to 5 
 put "Tim" into field "Name" of card x
end repeat
end mosueUp


dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Form entry

Post by dunbarx » Wed Feb 05, 2014 12:32 am

Could be. How are your experiments going?

Craig

EDIT:

What I mean is, try it. And if it works, can you shorten that handler?

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Form entry

Post by marcelloe » Wed Feb 05, 2014 2:21 pm

I tested it before I posted it. I can remove the "if" statement. Is that what you mean by shorting the handler? Here is what I don't know how to work out. I won't know what the user is going to put into the field and I don't know which cards they will want to put that on. Is that clear?

Thank you for all your help.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Form entry

Post by Klaus » Wed Feb 05, 2014 3:13 pm

Hi Marcello,
marcelloe wrote:I won't know what the user is going to put into the field...
no problem really and doesn't matter!
"the text of fld XYZ" will give you whatever the user entered!
marcelloe wrote:... and I don't know which cards they will want to put that on.
Well, this sounds more like a USER INTERFACE problem! 8)


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Form entry

Post by dunbarx » Wed Feb 05, 2014 3:28 pm

I tested it before I posted it.
That is what I meant by experimenting. It is the only way to learn. More is sometimes gained by repairing and reworking your scripts than writing them in the first place.

Your test worked fine, no? When I asked if the handler could be shortened, I was just thinking along these lines:

Code: Select all

on mouseUp
if field "name" is not empty then
repeat with x = 1 to 5 
put "Tim" into field "Name" of card x
end repeat
end if
end mosueUp
Not a big deal at all, just something to play with. But the important thing is to see how LC works. The repeat control structure is a powerful tool, as you now see.

What Klaus meant was that the contents of the input field do not matter. The whole point is to allow the user access to that field, and then process the data. Here is something for you to think about: What if you required that the user input only a number, because you needed to do some arithmetic on that data. How could you ensure that? The reason being that if you needed, say, to add 100 to whatever the user put into the field, you would run into a big problem if that user accidentally entered "25x". See what happens if you do try to add those two strings. Now what?

Craig

Post Reply