Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: Additional row being created with HTML "<form>" tags

  1. #11
    Join Date
    Apr 2003
    Posts
    13,269
    Rep Power
    34

    Default Re: Additional row being created with HTML "<form>" tags

    Well, others might do it differently, but I'll give some ideas on how I would probably do it. Of course this will involve some javascript again.

    One way, is you could create a hidden field for each field that contains the the value 1 or 0 (or true/false, yes/no) and when the user changes any info in any field, you update the hidden value using javascript.

    Or you could use the hidden fields, to store a copy of the value that is selected, and then when the form is submitted, compare the current value against the hidden field. If it is different, you can update the database. If not do nothing.

    Those just come from the top of my head. But the second one sounds better to me.
    "The best software is the one that fits your needs." - A_A

    Virus free since: date unknown
    Anti-virus free since: August 2008

  2. #12
    Join Date
    Jun 2003
    Posts
    284
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    Yeh I like the second method too...second method too....I don't think I would have to use JS to do that...(becuase i think I would still do these checks on the server....but I wuold now only limit the update to what wuz actullay changed)...and also I will definately kno if they actually changed the data (something different...instead of "changing" it back to the samething)
    ﻈļŭώŭļƒ

  3. #13
    Join Date
    May 2003
    Posts
    3,041
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    So it is ok to run an update even if only one of the dropdowns have changed...or something is in the text area...right?

    I would use JS to determine if any of the dropdown menus item number is > 0. Or test that the length of the text area is > 0 ... make sure to also do a trim to eliminate blank space being submitted.
    Calm Like a BOMB

  4. #14
    Join Date
    Jun 2003
    Posts
    284
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    Quote Originally Posted by matronyx
    So it is ok to run an update even if only one of the dropdowns have changed...or something is in the text area...right?

    I would use JS to determine if any of the dropdown menus item number is > 0. Or test that the length of the text area is > 0 ... make sure to also do a trim to eliminate blank space being submitted.

    The problem with only checking the length is that there is no way to really check if the user actually changed what wuz initially there !


    Take for example....if there wuz "ABC" in the texarea the user may very well "change" that "ABC". I don'tr want to update some thing that hasn't really changed ! so I intend to compare whats there before the "change" and whats there after the "change" and only update what as actualy changed
    ﻈļŭώŭļƒ

  5. #15
    Join Date
    Jun 2003
    Posts
    284
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    Ok I'm back to square 1.


    I again have problems with the form tags:

    Code:
    <form> <!-- I'm using this form tag to capture the values selected in the drop down menu(s) -->
    <table>
    
      <tr> 
       <td>
          DECLARATION FOR THE VARIOUS DROP DOWN MENUS   
       </td>  
      </tr>
      .
      .
      .
      .
      <tr> 
       <form>
        <td> 
          DECLARATION FOR BUTTON 1 GOES HERE
        </td>
       </form>  
       
       <form>
        <td>       
          DECLARATION FOR BUTTON 2 GOES HERE  (I need this buton to capture what was selected in the above drop down menu(s))
        </td>
      </form>
      
      <form>
        <td> 
          DECLARATION FOR BUTTON  3 GOES HERE
        </td>
      </form>
       .
       .
       .
       .
      <form>
        <td> 
          DECLARATION FOR BUTTON  n GOES HERE
        </td>
      </form> 
    
      </tr>  
     </table>
    </form>


    For som starnge reason it seems that I'm able to determine that the values from the drop down menus were selected however I'm not able to get the actual values of the selections made in the drop down......



    I'm using HTML and PHP

    ALL my form declarations look lik this :

    Code:
    <form method="post" name="query_form" action="file_name.php">
    </form>
    Last edited by bluwulf; Sep 14, 2004 at 01:00 PM.
    ﻈļŭώŭļƒ

  6. #16
    Join Date
    Apr 2003
    Posts
    13,269
    Rep Power
    34

    Default Re: Additional row being created with HTML "<form>" tags

    More than likely you will have to use 1 form. Just make sure to give each form option a unique name and id.
    "The best software is the one that fits your needs." - A_A

    Virus free since: date unknown
    Anti-virus free since: August 2008

  7. #17
    Join Date
    Jun 2003
    Posts
    284
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    I figured thats what U would say......the last time I tried that it didn't work...thats how I came up with the idea of using so many forms....but I will go try again...!


    In fact I will go read up (again) about form tags
    Last edited by bluwulf; Sep 9, 2004 at 08:05 AM.
    ﻈļŭώŭļƒ

  8. #18
    Join Date
    Feb 2003
    Posts
    3,184
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    Ok, I know your worried about server reasources but I think it much ado about nothing. But anyway there are a couple ways you could do it; you could keep the old values of the data in hidden fields and then compare then OR you could use javascript with a onchange event on all the controls.

    Keeping the old values in hidden fields would be easier.

  9. #19
    Join Date
    Feb 2003
    Posts
    3,184
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    weird. hmm.. add a border to the table you'll notice that it not that there are new rows added but tha the form has a margin on it.

  10. #20
    Join Date
    Jun 2003
    Posts
    284
    Rep Power
    0

    Default Re: Additional row being created with HTML "<form>" tags

    Quote Originally Posted by Arch_Angel
    More than likely you will have to use 1 form. Just make sure to give each form option a unique name and id.


    Ok Arch I did what U said....now I have only one <form....></form> tag...but as I expected...it jus dosn't work it's almost like it can't recognise what button I have pressed...

    I must say that my code as changed a bit...this is what I now have:


    Code:
     <form> 
    
    
      <table> 
       <tr>
    
    
    
        <td>
         <table> 
          <tr>
           <td>
            DECLARATION FOR DROP DOWN MENU 1
           </td>  
          </tr>
    
          <tr>  
           <td>
             DECLARATION FOR DROP DOWN MENU 2
           </td>  
          </tr>
          .
          .
          .
          .
          <tr> 
           <td>
            DECLARATION FOR DROP DOWN MENU n
           </td>  
          </tr>
         </table>  
    
    
    
        <td>  
       </tr> 
    
    
    
    
       <tr>
        <td> 
    
         <table>
          <tr>
           <td>
            DECLARATION FOR BUTTON 1 GOES HERE
           </td> 
          </tr>
       
          <tr>
           <td>
            DECLARATION FOR BUTTON 2 GOES HERE  (I need this buton to capture what was selected in the above drop down menu(s))
    
        <!-- NOTE that this button is now sandwhich  between BUTTON 1 and BUTTON 3, and I think thats what is causing the problem. Because when I comment out BUTTON 1, BUTTON 2 now is able to capture the data values in the drop down menus -->
           </td> 
          </tr> 
    
          <tr>
           <td>
            DECLARATION FOR BUTTON 3 GOES HERE
           </td> 
          </tr>
          .
          .
          .
          <tr>
           <td>
            DECLARATION FOR BUTTON n GOES HERE
           </td> 
          </tr> 
         </table>
    
    
        </td>
       </tr>
      </table>
    
    
     </form>


    For some strange reason BUTTON 2 isn't able to capture the data values of the (above decleared drop down menus)

    As you can see BUTTON 2 is sandwhiched between BUTTON 1 and BUTTON 3, and I think thats what is causing the problem. Because when I comment out BUTTON 1 (and put </form> right below the declaration for BUTTON 2), BUTTON 2 is now able to capture the data values in the drop down menus.





    By the way, do I have to specify a unique id...(in fact I'm not so sure how I would do that...geneerate the unique id ?)


    I have made sure that all the form option names are unique though...wouldn't that be good enough ?



    And thanx owen...I think I will be going with comparison...using hidden feilds. But why do U say it's much to do about nothing....?
    Last edited by bluwulf; Sep 14, 2004 at 05:45 PM.
    ﻈļŭώŭļƒ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •