Announcement

Collapse
No announcement yet.

database-fields <--> new fields

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • database-fields <--> new fields

    hi,
    using SC6.
    maybe this is a problem which is correspondenting with this: http://www.scriptcase.net/forum/show...m-i-too-stupid


    I just made a test.

    Database:

    ID (ai) INT
    TEST1 TXT
    TEST2 TXT


    Form:
    (all database fields)
    + add "TEST3"


    Ajax:
    Test1 on click

    sc_ajax_message({Test2}, {Test3});



    Result:
    When I insert a value in TEST2 and TEST3 and than click into TEST1, a message is given:
    No title (its just blanc)
    message: TEST3 (the value I inserted)


    so... is this normal? i never noticed. is there a difference in acting with new fields, which arent in the database?
    or does "my scriptcase" just behaves strange? I just did install it new on a local machine, because my home-SC chrasched.
    Last edited by nina_sorensen; 11-09-2013, 06:47 AM.

  • #2
    No imho this is expected to occur. Ajax events happen on the client side and you are displaying data from the server side. When you have inserted data into field 2 and field 3 then this data resides locally as there has not been any submit to the server. When you click on the onclick ajax event that this is *not* a submit of the other fields. So imho you need to set ajaxevents on the other fields to make sure that they are available on the server side. Haven't tested it, but it might be that you need some globals here:

    onchange field1
    [glob_field1]={field1};

    onchange field 2
    [glob_field2]={field2};

    as these are php variables the data of the form will be transferred to the server.
    At least... I think.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      thank you.

      i broke it down to an easier problem:

      the fields are updated correctly.
      BUT if you use any variable, which isnt declared, it does not update any field in the ajax-script any longer.

      look:

      ajax on change:

      if ({contactname}=="")
      {
      {contactname}="here is nothing";

      }

      // sc_ajax_message({contactname}, $asny);
      works. if you delete the entry of contactname-field and change focus, than there is a new antry "there is nothing".

      BUT

      if ({contactname}=="")
      {
      {contactname}="here is nothing";

      }

      sc_ajax_message({contactname}, $asny);
      notice that message-macro isnt longer commentary.
      notice also that $asny doesnt exist.

      result is, that the field is updated right, but this isnt shown in the form.


      if ({contactname}=="")
      {
      {contactname}="here is nothing";

      }
      $asny="hurra";
      sc_ajax_message({contactname}, $asny);

      works again.


      you can test this. i made an new account an SC-testpage.
      v7.scriptcase.net/scriptcase_en/devel/iface/login.php
      login: test
      pass: test

      there is a form. look at ajax_onchange.
      Last edited by nina_sorensen; 11-09-2013, 09:15 AM.

      Comment


      • #4
        Originally posted by nina_sorensen View Post
        i made an new account an SC-testpage.
        How? Thanks ...

        Edit: Hab es gefunden ... ;-).
        Last edited by RHS; 11-09-2013, 01:52 PM.
        Best regards: - Reinhard -

        I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

        Comment


        • #5
          I'm missing the point. If I delete the text it gets the right value. If I enter something this is shown in the ajax message and is stored in the database, I set debug on and the pdo statement is correct.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            Originally posted by RHS View Post
            How? Thanks ...

            Edit: Hab es gefunden ... ;-).
            Ok, wo? Ich hab's noch nicht gefunden...
            Albert Drent
            aducom software netherlands
            scriptcase partner, reseller, support and (turn-key) development
            www.scriptcase.eu / www.scriptcase.nl

            Comment


            • #7
              http://www.scriptcase.net/scriptcase-demo-online/
              Best regards: - Reinhard -

              I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

              Comment


              • #8
                Originally posted by aducom View Post
                I'm missing the point. If I ...
                ok, sorry for speaking without explanation. i see this is not understandable.

                forget the first post in this thread. I didnt worte down ALL of the code. I did let out something which - as I thought - had nothing to do with the problem.

                the second posting is the base of the problem:

                when you write something into a field,
                firing the onchange-event,
                than change by code the value of another field (or even the same field)
                than everything is ok.

                BUT

                if you have a unset variable in the code, even if it is something complete different, and there is a variable used whithout beeing set up,
                then NO value in the form will change.

                p.e.

                you have in the code the variable $one.
                you set up $one
                ( $one="eins"; )

                and use it all around.

                THAN at one part of the script you make a misstake and spell it wrong:

                if ($onne == "eins")
                {....

                you have a new variable: onne whch is never been used before and which has no value of course.
                THAN
                something like {field1}="here we are" will not work anymore. try it in the test-account.

                Comment


                • #9
                  Originally posted by RHS View Post

                  Edit: Hab es gefunden ... ;-).
                  *g* guuuuut

                  Comment

                  Working...
                  X