This topic is locked
[SOLVED]

 dynamic autofill add page

9/24/2010 6:48:21 AM
PHPRunner General questions
T
tedwilder author

Hello

I do have some troubles.
I have a user field on my add page. it's a lookup field.

what I need is that when user choose a value on this field it automaticly fills the next field. The next field is filled thanks to an sql request.

It works ok if the user clik on " save" . But I what I want is BEFORE we clik on "SAVE" that script in event : "before record" is done. this way we can check that information that is going to be add to the record is accurate.

I see you have some " add button" function. I think that adding a button to " auto fill " the form ( execute sql request to fill fields that are based on what the user choosed on 1st field) might be good but I dont know javascript..and it's not exactly clear hos to use the button function.

On some site, when you choose a value in the lookup field it dynamicly changes others field of the form.

that's something I'd like to do here.

( for isntance I need to see stock of product before the adding the record: so choosing a product will instantly show me the stock level, or choosing a user name will instantly show me his adress and only THEN I can clik on " save/add record" ).

thanks a lot.

A
ann 9/24/2010

Hi,
you can set up these fields as dependent dropdown boxes. Set up first field as main dropdown, other fields as dependent dropdowns.

Use Lookup wizard on Edit as settings dialog on the Visual Editor tab for this purpose.

Also I recommend you to have a look at the 'How to setup dependent dropdown boxes on Edit/Add pages' tutorial:

http://xlinesoft.com/phprunner/php-database.htm

T
tedwilder author 9/26/2010



Hi,
you can set up these fields as dependent dropdown boxes. Set up first field as main dropdown, other fields as dependent dropdowns.

Use Lookup wizard on Edit as settings dialog on the Visual Editor tab for this purpose.

Also I recommend you to have a look at the 'How to setup dependent dropdown boxes on Edit/Add pages' tutorial:

http://xlinesoft.com/phprunner/php-database.htm


Hello.

yes thank you. But I had to change my database structure in order to use that ( this feature cant look in another field of the same table, it has to use 2 table with a link field...) but ok. But still It doesnt really answers my problem. I need for instance when user pick an article in the lookup article that it triggers a check on stock field and print or do something based on the number in stock field linked to this article . instance : if stock is under 2 then send mail to admin to tell him to buy more. This has to be done BEFORE record is added because if stock =0 I dont want it to add this record. and Events "before record" doesnt allow me to stop the record process .

thank you.

Sergey Kornilov admin 9/26/2010

BeforeAdd event does allow you to stop add new record process:

http://xlinesoft.com/phprunner/docs/before_record_added.htm