Dynamically adding fields to a form

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

Post Reply
nicoloose
Posts: 99
Joined: Mon Sep 16, 2013 3:35 pm

Dynamically adding fields to a form

Post by nicoloose » Mon Jan 13, 2014 9:35 am

Happy New Year ALL,

I am trying to create an invoice detail type scenario where I can add multiple lines of the same information to a form. The detail can have one to 5 detail lines. Can anyone suggest how I can do this? Ideally I would like to start off with one detail line where I would choose a product from a drop down list, enter the information such as cost, qty etc and then click "Enter another Line". Another detail line would be presented to the user and so on?

Many thanks
Nic

vedus
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 153
Joined: Tue Feb 26, 2013 9:23 am

Re: Dynamically adding fields to a form

Post by vedus » Mon Jan 13, 2014 2:41 pm

the most simple method i know is this

Code: Select all

put "aa" into line 1 of fld 1
check the dictionary with keyword "add"

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

Re: Dynamically adding fields to a form

Post by Klaus » Mon Jan 13, 2014 2:51 pm

Hi vedus,
vedus wrote:check the dictionary with keyword "add"
which you did not obviously :D
-----------------------------------------------------------------------------------------------
Add:
Adds a number to a container and places the resulting value in the container.
...
----------------------------------------------------------------------------------------------

Best

Klaus

vedus
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 153
Joined: Tue Feb 26, 2013 9:23 am

Re: Dynamically adding fields to a form

Post by vedus » Mon Jan 13, 2014 3:41 pm

Klaus wrote:Hi vedus,
vedus wrote:check the dictionary with keyword "add"
which you did not obviously :D
-----------------------------------------------------------------------------------------------
Add:
Adds a number to a container and places the resulting value in the container.
...
----------------------------------------------------------------------------------------------

Best

Klaus
hehe hi klaus ;)
well some times i forget some lines :D
btw the question from the friend above is add field in the thread but the post is for lines :D
so here is what i use for field creation with code

Code: Select all

on mouseUp
  // Make a dialog
  ask "please enter the name of field" with "ok" and "cancel" 
  //get the result
  if it is not empty then
    //put the result into array
    put it into t1
    //create the field
    create field "fld1"
    //put the field in the card
    set the rectangle of fld "fld1" to 80,100,200,200
    //set the name into the name you get from the ask dialog
    set the name of fld "fld1" to t1
    //if is cancel exit
  else
    exit mouseUp
  end if
end mouseUp

Post Reply