Announcement

Collapse
No announcement yet.

ajax refreshed Select field has no data on insert

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

  • ajax refreshed Select field has no data on insert

    Hello,

    I have two select fields on a form and the value of the first one determines the value of the second one and refreshes it on an ajax onChange event set in the fields settings, not a seperate ajax event. However, when in insert mode the second select field is empty until I click the first field and change it. The addition of the new record is to one table and the values of the select fields are from another table. The values from the select fields in the second table are inserted and associated with the new record I'm creating in the first table. If I wanted the first value in the first select I have to change it back and the second select field then reloads. What can I put in the onBeforeInsert event that would make the first select field refresh the second select field?

    Thanks

  • #2
    My long winded explanation might be confusing so here are some screen shots.

    Initial form on insert
    screenshot1.jpg

    Form after field1 is changed
    screenshot2.jpg

    Comment


    • #3
      Yo tengo el mismo problema, no se si alguien ha conseguido que se lo solucione

      Originally posted by ancr2001 View Post
      My long winded explanation might be confusing so here are some screen shots.

      Initial form on insert
      [ATTACH=CONFIG]331[/ATTACH]

      Form after field1 is changed
      [ATTACH=CONFIG]332[/ATTACH]

      Comment


      • #4
        Tambien estoy con este problema.
        Leandro Carames
        http://www.softnetbaires.com.ar

        Comment


        • #5
          Yes, I have the same.
          I think this is because SQL in second field is triggered when you change the first.

          Also it would be great if you could set drop-down type field in "empty mode" so in the beginning it would show "choose something..." instead of taking first record from DB.
          Using Ubuntu Linux 13.04 and SC Professional MySQL 7.1.last
          We need: good and complete documentation written in proper English

          Comment


          • #6
            You can...

            Go to lookup section and check the radiobutton 'use title'. Then enter '*** please select ***' into title field and a silly value in the internal value. In the onvalidate you need to check the silly value to be sure that someone has changed the value to a valid one.

            the second lookupvalue is triggered by an onchange event. And if the field is initially filled then this trigger does not fire...
            Albert Drent
            aducom software netherlands
            scriptcase partner, reseller, support and (turn-key) development
            www.scriptcase.eu / www.scriptcase.nl

            Comment


            • #7
              Thanks a lot!
              That was what I needed.
              Using Ubuntu Linux 13.04 and SC Professional MySQL 7.1.last
              We need: good and complete documentation written in proper English

              Comment


              • #8
                i have a problem which is mostly like the one here, so i dont open a new thread.

                i have a lot of selectsfields. all are handling with the same table. i want that the select-fields dont show an item, whis is allready selected from another field.

                my sql is like this:

                SELECT
                mailvorlagentxt.id,


                SUBSTRING(CONCAT(mailvorlagennamen.Bezeichnung, " - ",mailvorlagentxt.`Text`), 1, 75)
                FROM
                mailvorlagennamen INNER JOIN mailvorlagentxt ON mailvorlagennamen.id = mailvorlagentxt.Bez
                WHERE mailvorlagentxt.bez not IN ([where])

                ORDER BY
                mailvorlagennamen.Bezeichnung, mailvorlagentxt.`Text`

                please ignore the most od the statement - it works. take a look at the "where":

                WHERE mailvorlagentxt.bez not IN ([where])


                so now. if i try it and set in the onload-event something like

                [where]="1,4,9";
                it works pretty well: every selct shows the items i want, no select has one of the "1", "4" or "9" items in it.

                but when i do the following, sc doesnt behave like i think it should:

                1. i call an onchange-event on every select field

                2. there, in the onchange-event i re-build the [where] variable and insert everything which is used in the select-fields

                3. i put ajax reload field feature on every select-field.


                this doesnt work. do you know why or how i can solve this?

                Comment


                • #9
                  Ajax processing doesn't work

                  Originally posted by aducom View Post
                  You can...

                  Go to lookup section and check the radiobutton 'use title'. Then enter '*** please select ***' into title field and a silly value in the internal value. In the onvalidate you need to check the silly value to be sure that someone has changed the value to a valid one.

                  the second lookupvalue is triggered by an onchange event. And if the field is initially filled then this trigger does not fire...

                  Wonderful Aducom. This is an excellent solution. Regards.

                  Comment


                  • #10
                    You can also try to select the option "Reload form when value has changed" which is below the Title in Lookup Settings of Select field.
                    I have noticed that Ajax solutions in SC sometimes freaking out.
                    Using Ubuntu Linux 13.04 and SC Professional MySQL 7.1.last
                    We need: good and complete documentation written in proper English

                    Comment

                    Working...
                    X