19 Replies Latest reply on Oct 1, 2008 6:33 PM by oicram

    What about a "Save This" button inside a repeat region?  --> (!) means crazy idea

    oicram Level 1
      I have a page that lists URL links.

      To allow easy update to the user, I have made a repeat region and inside that repeat region I have put
      1) Text Field(!).
      2) Button to delete the specific record.
      3)Another button that says "Save Changes".

      The problem is on 3).
      When the user click "save changes" I want him to go to another page called "update_link.php" in that page, there is a "update transaction" (nothing more) that should know what record to update, be trigger and, redirect to the previous page after the update.

      To that link called "save changes" I have add a onClick event with a Confirm Message. So, the update will only be executed, if the user chooses ok, if not, nothing happens.

      THE PROBLEM:
      If I append this on the url of the "save changes" button:

      update_link.php?id_update_link=

      he will correctly redirect to the update page, BUT in the update record transaction I have no idea from where should I get the value from? Is not from a Form, because I have no form on that "update_link.php" page.

      Maybe we can get the values from a "url parameter", BUT even if I have an idea about how to fill the "Get attribute from" field in the "update record transaction", IF I pass the URL like this:

      update_link.php?id_update_link=&title_link=&url_link=

      I will not go to the correct record to be updated, I suppose.

      QUESTIONS:
      1) How can we trigger an update transaction that is on a separate page from the Form fields? The "First Check Variable" on the update record transaction, should be configured with "URL PARAMETER" ?

      2) In the "Fields" Tab on "Get Values From" we must choose the URL PARAMETER to each record we would like to update, right(?). But how can we pass the other parameters over the URL and allow a proper redirection?

      Any help to get this scenario working?
      Thanks a lot in advance,
      Márcio
        • 1. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
          oicram Level 1
          I've also have try to use the GET method on the list page. When I hit (save changes) submit button, It process the form, and all values of the TextField passes to the URL. Then he goes to the update page, but the update page is not trigger. I don't know what should I put in the Update Record Transation on the "First Check Variable" Field. I've put the "name" of the form "submit button" that is on the "list page", but does not work. I have also try to put an URL Paramenter with that name, does not work either.

          Any Ideias PLLLLEEEEEASE. :S

          {update}
          Here is the link so you can see.
          Click the links page please.
          The remove and add works fine. You can also remove and add as you like.

          http://www.cantinho.org/admini_/modulos/editar_paginas/ADMINI_editar_paginas.php

          thanks...
          • 2. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
            oicram Level 1
            OK... I will try to be more clear this time.
            I have remove the form, the GET and the submit button.

            * I have a repeat region (RG).
            * On eatch record displayed be the RG, I have an EDIT link.
            * This link goes to a blank page that contains:
            a)a RECORDSET that filters data passed by the URL PARAMETER
            b)a UPDATE RECORD TRANSACTION

            Here is the relation between the URL PARAMETERS and the UPDATE RECORD TRANSACTION SERVER BEHAVIOR (SB).

            id_update_link --> value that I put on the SB over the "get primary key from" field.

            title_link AND url_link --> values that I put on the "field" tab of the SB. (I select "Get values from URL")

            To trigger the UPDATE automaticly I have in the SB the option "Entering Value" and I have write 1 as a value.

            PROBLEM:
            I get a success UPDATE message, BUT, no record as been updated at all.

            What is the problem? Any clue?

            here is the link, you must click on the links tab.
            then know that "editar" is the portuguese name for "edit".

            http://www.cantinho.org/admini_/modulos/editar_paginas/ADMINI_editar_paginas.php
            • 3. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
              Günter Schenk Level 4
              Hi Marcio,

              please post the code of "temp.php" somewhere on your server as .txt file -- without seeing what this page does, it´s impossible to give an answer.

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                oicram Level 1
                I already have send an e-mail saying thank you, but he does not appear here, at least yet.

                So, THANKS for your help once more.

                Here is the temp.txt
                http://www.cantinho.org/admini_/modulos/editar_paginas/temp.txt

                I think that I'm missing a "link" a "connection" a "desmos"(in ancian Greek): :) That between the URL that passes a value, and the entered value on the Text Field. But I don't know how to establish that connection...

                I think he passes the value that are actually on the database, BUT not the new values that we enter on the text field. And maybe that's why I get a update that is successful but, meaningless without saving the values that where input by the user.

                Could the problem be here?

                Also feel absolutely free to add, remove records as you wish for testing proposes.

                Well, thanks a lot once more,
                Marcio
                • 5. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                  Günter Schenk Level 4
                  Hi Marcio,

                  --------
                  I think that I'm missing a "link" a "connection" a "desmos"(in ancian Greek): That between the URL that passes a value, and the entered value on the Text Field. But I don't know how to establish that connection.
                  --------

                  well, you have to decide on one method, as your approach is technically impossible -- your update form has been configured to receive the to-be-updated values as URL parameters, which in turn are hard-coded in each of your "editar" links, e.g. temp.php?id_update_link=22&titulo_link=prima&endereco_link=do rui.

                  When clicking any of those links, it´s by nature exclusively those URL parameters respectively their values which are passed to temp.php, and there´s no way to "override" URL parameters with form values.

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                    oicram Level 1
                    Hi Günter,

                    The from with GET Method may work with this update, but I imagine big problems when trying to apply that method in a repeat region.

                    Let me just ask you one last question about the "link method":
                    The link "Editar" is hard coded, it's true, but I have not write the values myself.
                    I've use the:


                    So what I'd like to ask is:
                    IF instead of this:
                    conteudos_pag_link/temp.php?id_update_link=&titulo_link=

                    I will have this:

                    conteudos_pag_link/temp.php?id_update_link=&titulo_link=

                    I will keep getting the ID from the database and it's the right way to identify the record. So, I will keep the "$row_rs_admini_links" for retrieving the ID. And, for the other values, I will GET the values of the text field and put them on the URL.

                    The problem could be now, from WHAT Text Field I'm getting the values from...

                    If this approach is really impossible, OK. I will change to the Form with GET Method approach.

                    Is there any third? :s

                    Thanks. Hope you can give me some lights on this.

                    Márcio
                    • 7. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                      oicram Level 1
                      I've tried this last "Link" approach, and I think PHP don't understand what is the meaning of having a GET on the URL. :)
                      Or, if we prefer, I have no clue how to "well code" or "code at all", php. :s

                      So...
                      I've delete the link and I've put a form with a GET Method instead. But know, I'm getting an ADDT error telling me:
                      tNG_update.prepareSQL:
                      No Primary Key Column was set. (UPD_NO_PK_SET)

                      Maybe I will need to pass the ID on a hidden field...?

                      I will give it a try.
                      • 8. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                        Günter Schenk Level 4
                        Hi Marcio,

                        -------
                        Maybe I will need to pass the ID on a hidden field...?
                        -------

                        this should indeed do the trick.

                        -------
                        So what I'd like to ask is:
                        IF instead of this:
                        conteudos_pag_link/temp.php?id_update_link=&titulo_link=

                        I will have this:

                        conteudos_pag_link/temp.php?id_update_link=&titulo_link=
                        -------

                        $_GET['whatever'] will always fetch some value from a different page than the one you´re introducing this method to -- it can´t work on the very same page.

                        -------
                        I've tried this last "Link" approach, and I think PHP don't understand what is the meaning of having a GET on the URL.
                        Or, if we prefer, I have no clue how to "well code" or "code at all", php. :s
                        -------

                        I guess you´re just struggling with the usual HTML limitation in regards to how values can be passed from page A to page B -- it´s an either/or scenario, means you can´t mix form field values with URL parameters on the very same page.

                        -------
                        If this approach is really impossible, OK. I will change to the Form with GET Method approach.
                        -------

                        in fact you should rather establish individual forms for each "delete" and "update" button, and you´d better change the form methods to POST plus change temp.php so that it will retrieve the values using $_POST['fieldname'] instead of $_GET['fieldname'] -- that´s notably more secure.

                        Cheers,
                        Günter Schenk
                        Adobe Community Expert, Dreamweaver
                        • 9. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                          oicram Level 1
                          [update]This post has been made without seeing the last answer from you.[/update]

                          Ok. It almost work now.

                          I have put an hidden field with an ID (the will be retrieved buy the "update SB".

                          And

                          I have change the Fields values of my "update SB" to correspond with the Text Fields names. The names that will appear on the URL to get.

                          Now, if I have only ONE text field it works. Why, I suppose, it's because is that text field that corresponds on the text field name that I have put on the Update SB.

                          But the repeat region SB (I believe) maybe automatically generates text field names when he/she (I don't know the sex of the repeat region SB), repeats a new region.

                          I believe it will call it TextField1 then TextField2 etc... If this is the case, then, the URL will also change, SO, the update SB is expecting the "textfield1" it's true, but is not expecting the "textfield2" or "textfield3" or "textfieldn".

                          If all this assumptions are correct, Oh BIG SIR Günter, please help me out with this:

                          How can we configure the Update Record Transaction Server Behavior to be sensible to this textfield changes generated by the repeat region, that[upd] subsequently, change[upd] the URL parameters to retrieve?

                          Marcio
                          • 10. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                            oicram Level 1
                            In the meanwhile, I will change the $_GET to $_POST, this is not a security sensible data, BUT, I know that the $_GET as some limitations regarding the length of the variables, and sometimes we get very long links. :)
                            • 11. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                              oicram Level 1
                              "in fact you should rather establish individual forms for each "delete" and "update"

                              Done, Np about that. The remove link as no form associated, is only this:
                              conteudos_pag_link/remover_link.php?id_apagar=

                              It's the remover_link.php that retrieves the URL param and deletes.

                              Change from $_GET to $_POST: OK.

                              Where:
                              In the recordset filter, inside the update page.
                              In the update SB (i've choose/change to "Form Variable")
                              In the form on the "list page". I have change that form method to POST.

                              All works almost fine.

                              He updates one record just fine, but he does not update the others...
                              In the Variable Name field on the Update SB I have a static string: "titulo_link2" and "url_link2" maybe I must change this to a dynamic value? But what... ?
                              • 12. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                                Günter Schenk Level 4
                                Hi Marcio,

                                -------
                                Now, if I have only ONE text field it works. Why, I suppose, it's because is that text field that corresponds on the text field name that I have put on the Update SB.

                                But the repeat region SB (I believe) maybe automatically generates text field names when he/she (I don't know the sex of the repeat region SB), repeats a new region.

                                I believe it will call it TextField1 then TextField2 etc... If this is the case, then, the URL will also change, SO, the update SB is expecting the "textfield1" it's true, but is not expecting the "textfield2" or "textfield3" or "textfieldn"
                                -------

                                please give a link to the page code to see if this assumption is correct.

                                Cheers,
                                Günter Schenk
                                Adobe Community Expert, Dreamweaver
                                • 13. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                                  oicram Level 1
                                  No it isn't. :s I have seen the source code, the repeat region preserves the textfield name. :s But somehow, only the last textfiled of the list generated by the repeat region gets updated. :s

                                  http://www.cantinho.org/admini_/modulos/editar_paginas/ADMINI_editar_paginas.php

                                  In Mozilla Firefox I can see the source of the php.

                                  the txt:
                                  http://www.cantinho.org/admini_/modulos/editar_paginas/ADMINI_editar_paginas.txt

                                  But in Firefox it's better, because we get colors. :)
                                  • 14. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                                    oicram Level 1
                                    Ok. I think I have a problem in my recordset definition on the temp.php page.

                                    My runtime values are: $_POST['titulo_link'] and $_POST['titulo_link'] and I believe the strings are not correct.

                                    I will change them to titulo_link2 and url_link2 the names of the TextFields that are Post by the form?

                                    I will give it a try...
                                    • 16. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                                      oicram Level 1
                                      I'm crazy enouph to start a counter and force the change of the ID names on the TextFields.

                                      I will add a counter on the Head Section:



                                      Then after the begining of the repeat region I will add:


                                      Then on the Id Value of the TextFields I will have:
                                      id="titulo_link2"

                                      So I will get "titulo_link20" "titulo_link21" "titulo_link22" etc...

                                      On temp.php in the Update SB Instead of having a variable name like:
                                      titulo_link2

                                      I will have:
                                      titulo_link2

                                      Maybe I also need to change the recordset RunTimeValues options.

                                      But I don't know how to add the counter on this:
                                      $_POST['titulo_link2']

                                      maybe:

                                      $_POST['titulo_link2']

                                      or $_POST['titulo_link2$contador'] or $_POST['titulo_link2.$contador']

                                      ...
                                      OR,

                                      I need a coffee. +_+ .
                                      • 17. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                                        oicram Level 1
                                        Günter,

                                        No success with the counter. :(
                                        Now I'm sure that all the textfields have different names. So maybe it's not a name related.

                                        And I'm also sure that, with this counter solutions, I cannot pass the values.

                                        I have create two new pages to test this.
                                        One with the counter on the text fields (that works)here :
                                        http://www.cantinho.org/admini_/modulos/editar_paginas/ADMINI_editar_paginas_2.php

                                        Another that, does not have the Update SB, it should only show the value of fields passed, (that doesn't work) here :

                                        http://www.cantinho.org/admini_/modulos/editar_paginas/conteudos_pag_link/temp_2_testar_va lores.php

                                        I don't have any more ideas. :(
                                        • 18. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                                          Günter Schenk Level 4
                                          Hi Marcio,

                                          -------
                                          I have create two new pages to test this.
                                          One with the counter on the text fields (that works)here :
                                          http://www.cantinho.org/admini_/modulos/editar_paginas/ADMINI_editar_paginas_2.php
                                          -------

                                          when looking at the sourcecode of this page, I see you´ve defined one form, and within this form you´re looping through several "Titulo", "Endereço" and hidden "id_update_link" fields.

                                          This can´t work, as you´ll need to have each "instance" (Titulo, Endereço, id_update_link) embedded in its own form -- right now your single form is going to pass *all* inherent data to temp_2_testar_valores.php rather than a single instance.

                                          Cheers,
                                          Günter Schenk
                                          Adobe Community Expert, Dreamweaver
                                          • 19. Re: What about a "Save This" button inside a repeat region?  --> (!) means crazy idea
                                            oicram Level 1
                                            When we do this alone, you can have an elephant in front of your nose, but you just can see it. :S

                                            A BIG AMAZING EXTRAORDINARY EXCELSIUS WOW YUPI WUNDERBA(?): THANK YOU.

                                            One day I need to pay you, not a bottle of wine BUT a all Winiard!! :S
                                            Hope we never see eatch other. :p Or at least, not before I start earning money with web development. :p

                                            I will struggle now with the "sucessfull update message" that appears on every instance, instead of appearing ONLY in the one where we have click the update button on...

                                            Thanks once more,
                                            Márcio