This topic is locked
[SOLVED]

 Adding records on the fly on EVERY tipe of field.

3/17/2011 7:31:20 PM
PHPRunner General questions
Z
zeth385 author

Again, bothering you guys with my questions... Well, I have a form that contains several fields that require more than one records to be added in: i.e. Date of document reception: We receive a document today, regarding a special request for item 1, and tomorrow we receive another document regarding the same special request for item 1. What i have done is to set Five "Date_of_document_reception" fields on my table, but it happens that those empty fields are displayed on the add/edit page, and of course, may be more than five dates. What I would like, is that when we receive more than one document regarding the same thing, we can add that date "on the fly"... Maybe with label that reads: Add new date, and then, next to the previous date, user can add a new one.
Hope I have explained this thing correctly...
Thanks

C
CodeDog 3/17/2011

Roderick,
If I'm understanding what you're trying to do, it sounds like you'd need a child table for your dates. Anytime you have the need for a dynamic amount of data to be associated with a record that's usually the way you want to go. Create a table to contain the dates (and any other information), and link the two tables with a common field. Then, if only one date is needed only one child record will be added. If 50 dates are needed, 50 child records, and so on. Usually referred to here as Master/Detail. User can add as many or as few dates as necessary.
If this isn't what you're looking for disregard, but it sounds like it...

Z
zeth385 author 3/18/2011

Thanks, CodeDog... Yes, that's what I'm looking for!!! I've tried what you said, but my problem is that I have no clue on how to show this dynamic relation in the the Add/eddit page. The only option available seems to be showing details table underneath the whole form, and the only way to add/edit those child records is by the inline way... The problem is that the user gets confused with this layout: they want to have this "Details" attached to the form, i.e: above this date field, there's a bunch of oder fields that are related to the date, so going all the way down, just to add one date, or two, and then going all the way up to continue adding info it's kinda frustrating... If there is no other way... Well... There is no other way... But I'm sure there is...
Thanks again for the quick response!

C
CodeDog 3/18/2011

It would probably be easier to see an example of what you need to do, but here's another option.
You could create an archive table for these dates and related information, and only have one field in your primary table for each. Then, add a button to your screen for "Add New Date" that will send the current contents of those fields to the archive table and allow the user to update/edit those fields in the primary table. You could still link the primary table to the archive table in a Master/Detail relationship, but make the detail display only and non-editable (by the user). That would show all information on one screen, but still allow editing only in the main form.
Something like that work in this case?

Z
zeth385 author 3/18/2011

This is precisely what I want!!! Thanks for enlighten me!!! Now, I have a question... How do I set the button, so it can do what you said??... I'm a newbie in this programming matters

. Thanks! I think I saw something here in the forum, regarding to saving data into another table, or something like that... right?
Cheers!

C
CodeDog 3/18/2011

Yes, if you do a search like "copy data to another table" (without the quotes) in the PHPRunner forums you'll see lots of threads on the subject, and there's a video tutorial here on table relationships that should get you through that part.
Sounds like this might be just what you're looking for, let me know how it works for you...

Z
zeth385 author 3/18/2011



Yes, if you do a search like "copy data to another table" (without the quotes) in the PHPRunner forums you'll see lots of threads on the subject, and there's a video tutorial here on table relationships that should get you through that part.
Sounds like this might be just what you're looking for, let me know how it works for you...


YES!!! it worked!!! Thank you very much!!! Gracias!!! Danke Shön!!! Really, this saved my ass!!!

C
CodeDog 3/19/2011

Glad to hear that did it for you, Roderick...