Lots of JPanels working from a single JFrame

What I'm trying to do in this simple program is display a JPanel (called Panel1) in a JFrame(called MainFrame), and make it so that when you click the button that is displayed in Panel1 - the frame is updated and displays a new JPanel (called Panel2). Sounds like it should be quite simple, but I don't know how to update. Does dispose() have something to do with it? Thanks in advance.
import java.awt.*;
import javax.swing.*;
public class MainFrame extends JFrame
private int x;
public MainFrame(){
Panel1 panel1 = new Panel1(this);
this.getContentPane().add(panel1);
this.setSize(1024,770);
this.setVisible (true);
this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
public void redisplay(JPanel jp){
this.getContentPane().add(jp);
public static void main(String [] args){
MainFrame mf = new MainFrame();
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Panel1 extends JPanel implements ActionListener
private JButton jbutton;
private MainFrame main;
public Panel1(MainFrame ma)
main = ma;
try {
jbInit();
catch(Exception ex) {
ex.printStackTrace();
void jbInit() throws Exception {
jbutton = new JButton("Go to Panel1");
this.add(jbutton);
jbutton.addActionListener(this);
public void actionPerformed(ActionEvent e){
if (e.getSource() == jbutton) {
Panel2 panel2 = new Panel2(main);
main.redisplay(panel2);
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Panel2 extends JPanel implements ActionListener
private JButton jbutton;
private MainFrame main;
public Panel2(MainFrame ma)
main = ma;
try {
jbInit();
catch(Exception ex) {
ex.printStackTrace();
void jbInit() throws Exception {
jbutton = new JButton("Go to Panel1");
this.add(jbutton);
jbutton.addActionListener(this);
public void actionPerformed(ActionEvent e){
if (e.getSource() == jbutton) {
Panel1 panel1 = new Panel1(main);
main.redisplay(panel1);

You need to remove the first panel before you add the new one, otherwise it will not be displayed properly.
try:
public void redisplay(JPanel newPanel) {
  getContentPane().removeAll();
  getContentPane().add(newPanel);
  // you may need this also:
  revalidate();
// you can also try this:
public class MainFrame extends JFrame {
  JPanel currPanel;
  public void redisplay(JPanel newPanel) {
    getContentPane().remove(currPanel);
    getContentPane().add(newPanel);
    // and you might need this:
    revalidate();
public class

Similar Messages

  • Calling a method on a jFrame from a jPanel that created by the jFrame

    Hi all
    I can not for the life of me work out how to do this.
    Calling a method on a jFrame from a jPanel that created by the jFrame.
    I have used this code to set a handle for one jPanel to another.
    i.e I can create new jpanel and pass in handles from one to another but not back to the jFrame.
    // this is sudo code
      private Panel_Top topPanel;
      private Menu_Panel menuPanel;
      private DataPanel dataPanel;
    //create new
        topPanel = new Panel_Top();
        menuPanel = new Menu_Panel();
        dataPanel = new DataPanel();
    // add handles from one to another
        menuPanel.setDataPanel(dataPanel);
        topPanel.setDataPanel(dataPanel);
        topPanel.setMenu_Panel(menuPanel);
        dataPanel.setMenu_Panel(menuPanel);
    // in each class I use this to set
      public void setDataPanel(DataPanel dataPanel) {
        this.dataPanel = dataPanel;
      }But I can not seam to get a handle back to the jFrame that created it.
    Please help
    as you can see I am trying but no luck so far
    Thanks

    class Life extends JPanel{
          pulic Life( JFrame owner )
                owner.doSomething(); // pass the JFrame to the constructor and feel free to use it
    }[code[                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • HT2688 Working on a single computer with multiple users, I have set things up to allow each user to view and listen to the others' music libraries under the "Shared Library" function.  Can you then connect an iPod touch and copy music from a shared librar

    Working on a single computer with multiple users, I have set things up to allow each user to view and listen to the others' music libraries under the "Shared Library" function.  Can you then connect an iPod touch and copy music from a shared library?

    Was your wife logged into the libray at the time you tried to log in? I have had a similar problem and it was because another user was logged into the library when I attempted to. I got the permission denied banner.

  • I am new to EPUB fomat and I am facing a lot of difficulties in exporting my work from InDesign CS6

    Hi..I am new to EPUB fomat and I am facing a lot of difficulties in exporting my work from InDesign CS6. The problem is that I have got a financial report of about 100pages to export as EPUB, with lots of graphs etc..and when I export it, to EPUB 2.0, the following happens:
    1. The image quality is quite low (even if the original images are of high quality, and during export, i put the image to max quality)
    2. The graphs do not appear where they should be! All the imags in fact appear after the long paragraphs of text..meaning everything appear quite messy and in an unordered manner.
    I have read that images should be anchored, and doing so, the result is quite better, but still, some images appear at the end of the text!!d
    That is, the end result, in terms of pagination and graphics, is no way like it should have been, compared to the indesign file (page 5 is displayed after page 10, image on page 4 appears on page 9 etc..)
    PLEASE HELP..
    P.S :
    I am using Adobe digital edition to view my EPUB..I have also tried CALIBRE and SIGIL!! But I am not too sharp in eiting CSS codes etc...

    Hi Akshay,
    If you want your images to appear standalone with no other page item on the page, then you can insert Page break on an image.
    This is how you can specify a page break:
    1. Select the image
    2. Goto Object->Object Export Options
    3. Select EPUB and HTML tab
    4. Select Custom Layout check box and then check Insert Page break. You can select from the option in the dropdown-Before Image, After Image, Before and After Image as per your requirement.
    Regarding your question about images:
    You export your graphs as JPEG but are those JPEGs of good resolution? If they are, then InDesign is doing something wrong during export but if the JPEGs are not of good quality then it is not an export issue. Please provide some more details here.
    Regards,
    Pooja

  • Runtime.exe() is not working from within a jar file.

    Hi All,
    I have a jar file which have classes and a package in it.
    One of these classes is calling another class which is present in the package.
    The code i am using it is as follows:
    Runtime r=Runtime.getRuntime();
    Process p=null;
    p=r.exec("java deep.slideshow.PlayShow");It is working fine when i am executing it without making jar file.
    But when i make a jar file of all these things , this exec() is not working.
    I have tried a lot.
    If any body has any idea suggest me.
    Thanks

    thanks a lot for your reply friend.
    I tried the same you tell me to do by using the cmd;
    java -cp my.jar package.class  And then tried to make the jar file with the help of eclipse,
    after adding my jar file into classpath of my project in eclipse.
    Its working fine on my local system.
    But when i put this jar file on some other system it does not call my jar file(obviously bcz it will not the find the jar file according to the classpath set on my local system. )
    Is there any way that i can keep this jar into my project and then can give the classpath dynamically
    so that it can pick the file from my project automatically.?
    Later on i will pack this whole thing into a full jar file and it will work on a single click.
    Is it possible or not ?
    Please suggest me.
    Thanks

  • JPanel that close the parent JFrame

    Hello.
    I'm puzzled... how can I close a JFrame from the JPanel it contains?
    I mean:
    I have a Form that extends JFrame. In this form there's a JPanel, which has a BorderLayout. In the South part of the BorderLayout there's a JPanel (BoxLayout) that contains a JButton.
    I'd like this JButton to get disposed of the Form.
    How should I?
    Is there a better way to manage with this?
    (putting the button somewhere else...)
    Thank you

    Sorry, I forgot to mention that my sub-panel is in another class, another file.
    So I don't know how to call the parent frame.
    I tried with some .getParent(), but I get
    JPanel
    JLayerPane
    JRootPane
    and no JFrame.
    I could just put everything into 1 single class (or inner classes at least), but if there's a chance to keep them in different files, I would be glad to learn about it :)
    Thank you.

  • SSRS Report Returning Double Quote string from a Single Quote String

    Hi, I'm getting weird thing in resultset from SSRS report when executed. When I pass parameter to a report, which passes String that has single quote value to a split function , it returns rows with double quote. 
    For example  following string:
    'N gage, Wash 'n Curl,Murray's, Don't-B-Bald
    Returns: 
    ''N gage, Wash ''n Curl,Murray''s, Don''t-B-Bald
    through SSRS report.
    Here is the split function Im using in a report.
    CREATE Function [dbo].[fnSplit] (
    @List varchar(8000), 
    @Delimiter char(1)
    Returns @Temp1 Table (
    ItemId int Identity(1, 1) NOT NULL PRIMARY KEY , 
    Item varchar(8000) NULL 
    As 
    Begin 
    Declare @item varchar(4000), 
    @iPos int 
    Set @Delimiter = ISNULL(@Delimiter, ';' ) 
    Set @List = RTrim(LTrim(@List)) 
    -- check for final delimiter 
    If Right( @List, 1 ) <> @Delimiter -- append final delimiter 
    Select @List = @List + @Delimiter -- get position of first element 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    While @iPos > 0 
    Begin 
    -- get item 
    Select @item = LTrim( RTrim( Substring( @List, 1, @iPos -1 ) ) ) 
    If @@ERROR <> 0 Break -- remove item form list 
    Select @List = Substring( @List, @iPos + 1, Len(@List) - @iPos + 1 ) 
    If @@ERROR <> 0 Break -- insert item 
    Insert @Temp1 Values( @item ) If @@ERROR <> 0 Break 
    -- get position pf next item 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    If @@ERROR <> 0 Break 
    End 
    Return 
    End
    FYI: I'm getting @List value from a table and passing it as a string to split function. 
    Any help would be appreciated!
    ZK

    Another user from TSQL forum posted this code which is returning the same resultset but when I execute both codes in SQL server it works and return single quote as expected.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8d5c96f5-c498-4f43-b2fb-284b0e83b205/passing-string-which-has-single-quote-rowvalue-to-a-function-returns-double-quoate?forum=transactsql
    CREATE FUNCTION dbo.splitter(@string VARCHAR(MAX), @delim CHAR(1))
    RETURNS @result TABLE (id INT IDENTITY, value VARCHAR(MAX))
    AS
    BEGIN
    WHILE CHARINDEX(@delim,@string) > 0
    BEGIN
    INSERT INTO @result (value) VALUES (LEFT(@string,CHARINDEX(@delim,@string)-1))
    SET @string = RIGHT(@string,LEN(@string)-CHARINDEX(@delim,@string))
    END
    INSERT INTO @result (value) VALUES (@string)
    RETURN
    END
    GO
    ZK

  • I can't get Dr Browns Image Processor Pro to work from Bridge with Photoshop CC 2014

    We use the wonderful DR Browns Image Processor Pro script a lot, but cannot get it to work from Bridge with PS CC 2014. When I select files in Bridge CC and then go to Tools> Dr Browns Services 2.3.1 > Image Processor Pro it just pops up an error message that says ReferenceError: photoshop is undefined.
    The actual script works fine if I launch it from Photoshop CC 2014 - just not if I load it from Bridge CC.
    I have unistalled it and re installed a few times, both manually and through the Extension Manager CC.
    I am using a Win 7 64bit computer.
    I assume there is some change in the scripting part that loads Photoshop from bridge but not sure. It worked fine in CC. Just not CC 2014.
    I opened the Dr Browns Services .jsx file but don't see anything obvious. This is the section related to the Image Processor Pro part:
      // This routine takes an array of files. If called by Photoshop,
      // it will invoke Dr. Brown's Process 1-2-3 with the files. If called by
      // any other app, it will send a BridgeTalk message to Photoshop
      // to invoke this routine with the same arguments.
    drbrownserv.process123 = function (files) {
    // Bring Photoshop to the foreground.
      BridgeTalk.bringToFront ("photoshop");
      // Create a new BridgeTalk message for Photoshop to invoke
      // Image Processor with the selected files
      var btMessage = new BridgeTalk;
    btMessage.target = "photoshop";
      btMessage.body = "drbrownserv.process123 (" + files.toSource () + ");";
      btMessage.send ();
      } else {
    photoshop.runActionCommand ('611736f0-9c46-11e0-aa82-0800200c9a66', files);
      catch (error) {
      if (error.number != 8007) // Don't report user cancelled errors.
      drbrownserv.alert (error);

    I copied that .jsx file to a new name "Xbytor Image Processor Pro.jsx" edit that file changed the string Dr Browns services to "Xbytor Image Processor Pro" then commented out all the code that added tools menu items but "Image Processor Pro" and I put that file into
    "C:\Program Files (x86)\Common Files\Adobe\Startup Scripts CC\Adobe Bridge" even though Bridge CC is 64Bit seems to use theat location.
    Bridge CC was updated by the creative clouds update and opens Photoshop CC 2014 now

  • Can't Find Server at... error -- only one site, works from non-Macs fine

    Greetings:
    I have been getting a "Can't Find Server at www.teocommunications.com" error in Firefox for over a month now. I thought initially that it was a problem with the DNS entries and maybe the record had not proliferated though the DNS servers of my ISP or something of that nature. This is not the case.
    I have tried to bring my site up in Safari and it yields the same result.
    Did an nslookup, and everything resolves fine. Every once in awhile the site comes up on my Mac, but most of the time it gives the error. At all times, if you try to go to it from a Windows machine or my smart phone it works fine 100% if the time. My wife's Windows Vista machine with Firefox brings it up fine 100% of the time (she is on the very same network). I can get it to work for some reason if I totally reboot the Mac or reset the router (but the router is obviously not the problem)... it has to be something in the Mac OS (10.6 and 10.5) that is going on. I have eliminated all other possible problems. Curiously enough, it seems to also be a Leopard (not just Snow Leopard) issue... I can reproduce the error at my school (which is on a totally different network than my home) on the Mac Pro Intels they have which are still on Leopard.
    I am on the latest version of Snow Leopard on a brand new Mac Mini.
    This problem is only with my site (that I know of) but again it happens ONLY on Macs with Leopard or Snow Leopard. I am very annoyed by this problem and because it is my professional work site, it is imperative that I find the solution and soon.
    Hope someone can help.
    APPLE, please look into possible configuration or DNS issues in Leopard/Snow Leopard, as before I posted here, I did try several 'fixes' for issues like this for Firefox before I noticed that Safari was getting the same issue and ANY OTHER PLATFORM sees my page just fine!

    Hi Guys:
    It sometimes works from my Mac as well. I can get it to load if I reboot the Mac and then in a few reloads it is back to the same error.
    I did try openDNS as well and it did not still load. I can pretty much guarantee that it is not the DNS records, it is something going on between my Mac (or the Pros at school). Other sites from my same host work fine, my domain is setup exactly the same. They do use ISPConfig... and it could be something with that program, but I can not seem to confirm any problems there.
    I reset my router and the site is currently loading again on my Mac, but I can tell you it will be throwing the error in the very near future because that is one fix that worked before and it worked exactly two loads when I switched to a different wireless access point that is not my router.
    SO, the fact that it loads one to up to twenty times on someone's Mac is not enough to reproduce the problem. It takes several reloads and then the problem magically re-appears. This is why the fact that it is working right now on my machine is not good enough to call it fixed.
    Try to reload my site several times and see if it gives you the error.
    I have (as I stated) tried a lot of what is being suggested here and re-tried it, but nothing fixes it for very long
    I appreciate the help and hopefully we can figure out why the situation exists.
    Thanks for the help so far and please feel free to keep suggesting ideas, but for reference I have tried:
    1. modifying settings in Firefox (although it does not matter what browser I use,the result is always the same)
    2. resetting the router and DSL modem
    3. modifying the /etc/hosts file on my Mac
    4. dscacheutil -flushcache
    5. using openDNS instead of my ISP (which is AT&T)
    6. removing the DNS settings and using the router settings
    7. turning off airport and back on after 30 seconds
    8. renewing my DHCP clients
    9. Signning onto a different wireless access point (which is actually a new ISP that I am going with and so they are a totally different network and subnet).. they are setup all over town with wireless access. -- pretty cool actually.
    None of this seems to fix the problem loading only my site. Since I do have access to the hosting provider (I work with them)... I have done some things on the hosting side too. All to no avail.

  • HT201412 Iphone 4S screen stops working from time to time

    Iphone 4S screen stops working from time to time.
    sometimes for a few seconds, or sometimes many hours.
    I've resetted it when this happens, with no luck.
    I've restored it from back up, and the problem still persists.
    What can i do?

    Hello,
    I had that problem as well and the apple support suggested to turn off the LTE-mode to have a running system and try to exchange the micro-sim by my provider.
    THAT was not an option!
    BUT it seems to solve my problem in the following way after trying a lot of possibilties:
    In the menue properties/help (don't know the exact english word, because I run my phone in german)
    I switched on the nice feature 'flash LED' by incomming calls, msgs, and push infos.
    Today the flash feature was responding to different push notes very slowly.
    By switching this feature off the LTE-mode-tochscreen-not-responding-problem disappeared.
    We tried this on a other iphone, not having the metioned problem, and switched the LED-flash:
    the problem appeared. Switching the LED-flash off: problem disappeared!
    It seems to be a bug that the LED will hint Calls and MSGs in combination with the LTE mode!
    treated my phone very hard today to double check, but its still ok.
    @Apple:
    Please fix that issue in the next update.
    Hope, this helps you guys as well.

  • Limiting Number of connections from a single user

    Hi ,
    I am using 9.2.0.6 DB, i need to restrict the number of connections from a single user to 100.
    Currently the user is having DEFAULT profile, this profile is having several other users associated to it.
    What are all the available options to create restriction for a single user.
    Create a new profile and add the user to the New profile is the option i have.
    In that case can i create a copy of the Default profile and changing the SESSIONS_PER_USER to 100? will it work.
    Appreciate your suggestion.
    Thanks,
    Sathis
    Edited by: user7043544 on Feb 22, 2010 9:46 PM

    Hi,
    Since it is a default profile you can just create a new profile with the resource type you are interested it.
    And if you want to copy the existing profile extract its ddl through below command, change the profile name and required resource and run against the db.
    select dbms_metadata.get_ddl('PROFILE','<Profile_name>') from dual;Regards
    Anurag

  • Insert pages from a single document multiple times

    I'm trying to create a simple program that I can use to display PDF files that I can use to play at the piano. I perform often, and need to create "play lists" from which I can pull all, or part of, a PDF file containing music and display it.
    I have it all working, except for one problem. I may need to "repeat" a section of a piece. I'm building up the play list by calling AcroPDDoc.InsertPages for each item in the play list. If a PDF file appears multiple times in the play list, when I call InsertPages, the call fails.
    In this code snippet, pdDoc is the main doc to which I'm adding pages. playList is a generic List of my own PlayList objects, and I need to iterate through all the items in the playList except the first one, which is already loaded.
    This code works great unless the fileName I specify has already been opened. The call to AcroPDDoc.Open succeeds just fine, but the call to pdDoc.InsertPages fails if the file has already had pages from it inserted. All other documents work fine. The documentation, of course, doesn't mention this.
            int insertPage = pdDoc.GetNumPages() - 1;
            for (int i = 1; i < playList.Count; i++)
              var newDoc = new AcroPDDoc();
              var item = playList(i);
              int startPage = 0;
              int endPage = 0;
              if (newDoc.Open(item.fileName))
                startPage = Math.Max(0, item.startPage);
                endPage = Math.Max(0, item.endPage);
                var totalPages = newDoc.GetNumPages;
                if (item.endPage < 0 || item.endPage > totalPages)
                  endPage = totalPages - 1;
                int numPages = (endPage - startPage) + 1;
                if (pdDoc.InsertPages(insertPage, newDoc, startPage, numPages, 0))
                  insertPage += numPages;
    So, the questions:
    1.) Is it possible to load pages from a single document multiple times?
    2.) Is there a better way to do this? (That is, loop through a list of file names, starting and ending page numbers, and add the documents to an existing document.)
    Any help appreciated! Thanks -- Ken

    Hi Ken,
    >The documentation, of course, doesn't mention this.
    The documentation does not state explicitly that you can't insert pages again from a PDDoc you open again and never close.
    But it mentions that you get references only from an already opened PDDoc.
    "...Opens the specified document. If the document is already open, it returns a reference to the already opened PDDoc. You must call PDDocClose() once for every successful open..."
    It doesn't state that you can't insert pages from a referenced PDDoc but it seems so.
    I would close the PDDoc within your for-loop after inserting pages and release newDoc.
    Regards
    Norbert

  • HOW TO?: Need help setting up 3 different iCloud accounts for my kids (so each has own iMessanger)using same Apple ID (mine) ....they don't have their own separate email addresses to work from...how do I do this?

    Need help setting up 3 different iCloud accounts for my kids (so each has own iMessanger)using same Apple ID (mine) ....they don't have their own separate email addresses to work from...how do I do this?

    Any devices connected to the same icloud account can sync all the data on that account.  For this reason an icloud account is really for a single user.
    On a mac, if each user has their own account, then the itunes for that mac account should be set up to connect to that user's icloud account (System preferences>icloud).

  • Multiple Layouts in a single JFrame

    Hi,
    Is it possible to have multiple layouts in a single JFrame ? What I need to do is that I need to have following components in a SINGLE content pane of a JFrame:-
    A) 2 Labels
    B) 1 Button
    C) 1 4x4 Grid of buttons
    Now implement (C) I need to use GridLayout for nide grid like looks like
    mContentPane.setLayout(new GridLayout(4,4));
    But (A) and (B) obviously shouldn't be part of Grid. So I assume I need to use different layout in the same content pane. Any idea how can I accomplish this ?
    Thanks

    import java.awt.*;
    import javax.swing.*;
    class Testing extends JFrame
      public Testing()
        setLocation(400,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel main = new JPanel(new BorderLayout());
        JPanel top = new JPanel(new GridLayout(4,4));
        for(int x = 0; x < 16; x++) top.add(new JButton(""+(x+1)));
        JPanel bottom = new JPanel();
        bottom.add(new JLabel("JLabel 1"));
        bottom.add(new JButton("JButton"));
        bottom.add(new JLabel("JLabel 2"));
        main.add(top,BorderLayout.CENTER);
        main.add(bottom,BorderLayout.SOUTH);
        getContentPane().add(main);
        pack();
      public static void main(String[] args){new Testing().setVisible(true);}
    }

  • How do I insert multiple rows from a single form ...

    How do I insert multiple rows from a single form?
    This form is organised by a table. (just as in an excel format)
    I have 20 items on a form each row item has five field
    +++++++++++ FORM AREA+++++++++++++++++++++++++++++++++++++++++++++++++++++
    +Product| qty In | Qty Out | Balance | Date +
    +------------------------------------------------------------------------+
    +Item1 | textbox1 | textbox2 | textbox3 | date +
    + |value = $qty_in1|value= &qty_out1|value=$balance1|value=$date1 +
    +------------------------------------------------------------------------+
    +Item 2 | textbox1 | textbox2 | textbox4 | date +
    + |value = $qty_in2|value= $qty_out1|value=$balance2|value=$date2 +
    +------------------------------------------------------------------------+
    + Item3 | textbox1 | textbox2 | textbox3 | date +
    +------------------------------------------------------------------------+
    + contd | | | +
    +------------------------------------------------------------------------+
    + item20| | | | +
    +------------------------------------------------------------------------+
    + + + SUBMIT + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Database Structure
    +++++++++++++++++
    + Stock_tabe +
    +---------------+
    + refid +
    +---------------+
    + item +
    +---------------+
    + Qty In +
    +---------------+
    + Qty Out +
    +---------------+
    + Balance +
    +---------------+
    + Date +
    +++++++++++++++++
    Let's say for example user have to the use the form to enter all 10 items or few like 5 on their stock form into 4 different textbox field each lines of your form, however these items go into a "Stock_table" under Single insert transaction query when submit button is pressed.
    Please anyone help me out, on how to get this concept started.

    Hello,
    I have a way to do this, but it would take some hand coding on your part. If you feel comfortable hand writing php code and doing manual database calls, specificaly database INSERT calls you should be fine.
    Create a custom form using the ADDT Custom Form Wizard that has all the rows and fields you need. This may take a bit if you are adding the ability for up to 20 rows, as per your diagram of the form area. The nice thing about using ADDT to create the form is that you can setup the form validation at the same time. Leave the last step in the Custom Form Wizard blank. You can add a custom database call here, but I would leave it blank.
    Next, under ADDT's Forms Server Behaviors, select Custom Trigger. At the Basic tab, you enter your custom php code that will be executed. Here you are going to want to put your code that will check if a value has been entered in the form and then do a database INSERT operation on the Stock_table with that row. The advanced tab lets you set the order of operations and the name of the Custom Trigger. By default, it is set to AFTER. This means that the Custom Trigger will get executed AFTER the form data is processed by the Custom Form Transaction.
    I usually just enter TEST into the "Basic" tab of the Custom Trigger. Then set my order of operations in the "Advanced" tab and close the Custom Trigger. Then I go to the code view for that page in Dreamweaver and find the Custom Trigger function and edit the code manually. It's much easier this way because the Custom Trigger wizard does not show you formatting on the code, and you don't have to keep opening the Wizard to edit and test your code.
    Your going to have to have the Custom Trigger fuction do a test on the submitted form data. If data is present, then INSERT into database. Here's a basic example of what you need to do:
    In your code view, the Custom Trigger will look something like this:
    function Trigger_Custom(&$tNG) {
    if($tNG->getColumnValue("Item_1")) {
    $item1 = $tNG->getColumnValue("Item_1");
    $textbox1_1 = $tNG->getColumnValue("Textbox_1");
    $textbox1_2 = $tNG->getColumnValue("Textbox_2");
    $textbox1_3 = $tNG->getColumnValue("Textbox_3");
    $date1 = $tNG->getColumnValue("Textbox_3");
    $queryAdd = "INSERT INTO Stock_table
    (item, Qty_In, Qty_Out, Balance, Date) VALUES($item1, $textbox1_1, $textbox1_2, $textbox1_3, $date1)"
    $result = mysql_query($queryAdd) or die(mysql_error());
    This code checks to see if the form input field named Item_1 is set. If so, then get the rest of the values for the first item and insert them into the database. You would need to do this for each row in your form. So the if you let the customer add 20 rows, you would need to check 20 times to see if the data is there or write the code so that it stops once it encounters an empty Item field. To exit a Custom Trigger, you can return NULL; and it will jump out of the function. You can also throw custom error message out of triggers, but this post is already way to long to get into that.
    $tNG->getColumnValue("Item_1") is used to retrieve the value that was set by the form input field named Item_1. This field is named by the Custom Form Wizard when you create your form. You can see what all the input filed names are by looking in the code view for something like:
    // Add columns
    $customTransaction->addColumn("Item_1", "STRING_TYPE", "POST", "Item_1");
    There will be one for each field you created with the Custom Form Wizard.
    Unfortunately, I don't have an easy way to do what you need. Maybe there is a way, but since none of the experts have responded, I thought I would point you in a direction. You should read all you can about Custom Triggers in the ADDT documentation/help pdf to give you more detailed information about how Custom Triggers work.
    Hope this helps.
    Shane

Maybe you are looking for