Forums

DB Save multiplier doesn't work

yusufo 29 Feb, 2016
Hi,

I have a complex form with three pages.

On the third page I have a multiplier container to add one or more entries on a database table.

I saw the multiplier demo forms and I think the form configuration is great but the third database read doesn't make anything on database table.

Here is the debug code:

Array
(
    [chronoform] => RegistrarLlamada
    [event] => submit
    [buscarNombre] => Joaquin
    [buscarApellido1] => Duro
    [buscarApellido2] => Arribas
    [button3] => Buscar
    [idDemandante] => 8
    [nombre] => Joaquin
    [apellido1] => Duro
    [apellido2] => Arribas
    [telefono1] => 234234
    [telefono2] => 65645456
    [mail] => joaquin.duro@gmail.com
    [relacion] => 2
    [motivoConocer] => 0
    [demandante-siguiente] => Siguiente
    [idP] => 20
    [nombreP] => Pedro
    [apellidosP] => Alcalá
    [fNacimiento] => 
    [discapacidad] => 
    [porcentajeD] => 
    [dependencia] => 0
    [tipoPrestacion] => 0
    [masInfo] => 
    [BNextDemanda] => Siguiente
    [idD] => 0
    [derivacionAprocor__N__] => 1
    [derivacionOtros__N__] => 1
    [id] => Array
        (
            [0] => Array
                (
                    [data] => 608
                )

            [1] => Array
                (
                    [data] => 607
                )

        )

    [descripcion0] => 
    [estado0] => 0
    [derivacionAprocor0] => 2
    [derivacionOtros0] => 2
    [tbDOtros0] => 
    [fechaDerivacion0] => 26/02/2016
    [tipoRespuesta0] => 1
    [comentario0] => 
    [seguimiento0] => 
    [solucionado0] => 1
    [descripcion1] => Prueba#2
    [estado1] => 2
    [derivacionAprocor1] => 7
    [derivacionOtros1] => 1
    [tbDOtros1] => 
    [fechaDerivacion1] => 29/02/2016
    [tipoRespuesta1] => 2
    [comentario1] => 
    [seguimiento1] => 
    [solucionado1] => 1
    [enviarD] => Guardar
    [otro] => 
    [derivacionAprocor] => Array
        (
            [__N__] => Array
                (
                    [data] => 1
                )

            [0] => Array
                (
                    [data] => 4
                )

            [1] => Array
                (
                    [data] => 1
                )

        )

    [derivacionOtros] => Array
        (
            [__N__] => Array
                (
                    [data] => 1
                )

            [0] => Array
                (
                    [data] => 1
                )

            [1] => Array
                (
                    [data] => 5
                )

        )

    [descripcion] => Array
        (
            [0] => Array
                (
                    [data] => Prueba#3
                )

            [1] => Array
                (
                    [data] => Prueba#4
                )

        )

    [estado] => Array
        (
            [0] => Array
                (
                    [data] => 0
                )

            [1] => Array
                (
                    [data] => 2
                )

        )

    [tbDOtros] => Array
        (
            [0] => Array
                (
                    [data] => 
                )

            [1] => Array
                (
                    [data] => 
                )

        )

    [fechaDerivacion] => Array
        (
            [0] => Array
                (
                    [data] => 26/02/2016
                )

            [1] => Array
                (
                    [data] => 29/02/2016
                )

        )

    [tipoRespuesta] => Array
        (
            [0] => Array
                (
                    [data] => 0
                )

            [1] => Array
                (
                    [data] => 2
                )

        )

    [comentario] => Array
        (
            [0] => Array
                (
                    [data] => sdfsdfs
                )

            [1] => Array
                (
                    [data] => asfsdf
                )

        )

    [seguimiento] => Array
        (
            [0] => Array
                (
                    [data] => sdfsdfsdf
                )

            [1] => Array
                (
                    [data] => sdfd
                )

        )

    [solucionado] => Array
        (
            [0] => Array
                (
                    [data] => 0
                )

            [1] => Array
                (
                    [data] => 1
                )

        )

    [input_name_a] => 
    [input_name_b] => 
    [input_name_c] => 
    [Demanda] => Array
        (
            [idD] => 0
        )

)

Array
(
    [28] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => UPDATE `z2ma5_sioa_demandante` AS `Data` SET `nombre` = 'Joaquin', `apellido1` = 'Duro', `apellido2` = 'Arribas', `telefono1` = '234234', `telefono2` = '65645456', `mail` = 'joaquin.duro@gmail.com', `relacion` = '2', `motivoConocer` = '0', `otro` = '' WHERE `idDemandante` = '8';
                        )

                )

        )

    [33] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `z2ma5_sioa_protagonista` (`idP`, `nombreP`, `apellidosP`, `fNacimiento`, `discapacidad`, `porcentajeD`, `dependencia`, `tipoPrestacion`, `masInfo`) values ('0', 'Pedro', 'Alcalá', '', '', '', '0', '0', '');
                        )

                )

        )

    [44] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                        )

                )

        )

)


Also the multiplier data is there when you try to fill in the form again. How can I remove previously data?

If you want to take a look of the form, I can send you user and password by private message.

Thank you very much.
yusufo 03 Mar, 2016
Hi again,

still having this problem.

I don't know why DB Save action doesn't work. I attach some images of my configuration.

Thanks,

Joaquín
GreyHead 03 Mar, 2016
Hi yusufo,

You need to hide and disable the first multiplier entry so you don't' get the __N__ in the results.

I recommend that you don't use 0 in the option values as it can cause problems.

What to do you at the end of the debugger output - the MySQL queries should be displayed there?

Bob
yusufo 03 Mar, 2016
Thanks Bob.

I got it working but I cannot remove multiplier entries. For example,

if I fill in the form the first time with 3 multiplier entried, it makes the db save great!

Then, I fill in the form to introduce other values and with only one multiplier entry but the db save makes 3 inserts on DB table:

1. The first insert is good because it contains the data I need to submit.
2. The other 2 inserts are wrong because contais the data previously submitted when I filled in the form the first time with 3 multiplier entries.

How can I remove the multiplier data after making the db save?

Thanks,

yusufo
GreyHead 04 Mar, 2016
Hi yusufo,

I can't work out from this how the data is being re-loaded - are you using Multi-page actions or a DB Read?

In either case - it may be safest to use a Custom Code action in the form On Load event to unset any unwanted data.

Bob
This topic is locked and no more replies can be posted.