[SOLVED] Redirect plugin does not append jump url with LATEST data (after validation run)

kaito

Member
Hi,

I have a form with 4 elements embebed into an article:
- element 1 is a databasejoin type element: to select an id_ classroom from a database
- element 2 is a user type element (hide) to get id_user. This user element has a JavaScript to hide element 3 (CDD) if user value is a specific one
- element 3 is a cascading dropdown (CDD) watching element 1 to populate. This element is hidden/shown depending to JavaScript from element 2
- element 4 is a field type element (hide) with a PHP validation to get value coming from element 2 or element 3

This form has a redirect plugin to jump to another page "B" , and form´s parameter "Append jump url with data" is set to Yes. In the landing page "B" I retrieve the data appended in the url from elemets 1 and 4, to make dynamic sql queries for plotalot charts.

Problem is related to value stored in element 4:
- In database, value stored for element 4 is the correct one after PHP validation, this PHP validation runs and retrieves correct final value. So, no problem here
- But in redirect url, value presented for element 4 is always the value set as Default. It seems that it doesn´t get the final value obtained after PHP validation and append it to the jump url

I thougth that Redirect plugin was the latest plugin to run, so all the rest of PHP validations plugins would run before redirect plugin.

Please, any ideas to get in redirect jump url corrcet value after PHP validation (as it happens with value stored in database)?

Thanks in advance,

kaito
 
What are you doing in your php validation?
What is the sense of validating a hidden element? There's obviously no user input for this element, do you set/update this element (match/replace)?
 
Hi troester,

I´ll try to explain what I am looking for:
- It is a training class and there is a proffesor and several alumns. Every single alumn exposes his/her work and rest of the alumns vote the quality level of the work exposed.
- Proffesor can access to chart result for all the alumns but every alumn only can access to his/her results. I know who they are by their id_user, id_user=276 is for proffesor and rest id_user are for the alumns.

To access to votation results charts (plotalot plugin) I need 2 data to make chart sql query: id_classroom and id_user that made the presentation. These 2 data comes from the form:

- Element 1 (databesejoin): everybody can select what votation (id_classroom) are they looking for the results

- Element 2 (user) hidden: with this field I know who is asking for the results. If id_user=276 that means that logged user is the proffesor, then I let him only to access (JavaScript shows element3) to element 3 (CDD) to select wich alumn he wants to get check votation result.

- Element 3 (CDD watching element 1): it retrieves dropdown with all the alumns that were inscribed in the id_classroom. Element 3 is only for proffesor id, it is hidden for rest of the alumns

- Element 4 (field) hidden : is an auxiliary field that I use to run a PHP validation with Replace option, where I finally decide who (id_user) I am looking for the results, the alumn selected by proffesor ($usuarioseleccionado) or the alumn that has accessed to the form ($usuariologueado). See element4_PHPvalidation.jpg attached. PHP code is:

PHP:
$usuariologueado = '{$my->id}';
$usuarioseleccionado = '{afab_peticionresultados_hablarenpublico___aquienconsultamos_raw}';
if ($usuariologueado == '276') {
  return $usuarioseleccionado;
} else {
  return $usuariologueado;
}

So, in the list and database, PHP validation works and it stores correct data, but in the redirect plugin in the url (I use form data appended in the url to send data to plotalot plugin) I always get zero for value of Element 4 (zero is the default value of Element4), it seems that in the url Element4 has not run the PHP validation (but yes for storing in the database). See redirect_url_with_data.jpg attached, in this case id_user=280 (it is not 276, so it is an alumn), so Element 4 (afab_peticionresultados_hablarenpublico___aquienconsultamosfinal) should retrieve value=$usuariologueado=280 but it returns zero
 

Attachments

  • Element4_PHPvalidation.JPG
    Element4_PHPvalidation.JPG
    67.9 KB · Views: 61
  • redirect_url_with_data.JPG
    redirect_url_with_data.JPG
    67.1 KB · Views: 66
So maybe the "Replace" doesn't replace the spot where the URL is pulling from.
Did you try to use a calc element instead of field+php validation?
 
Hi troester,

You were rigth, I have installed calc element plugin (I have never used before) and it is easier and it works. When form is redirected, url provides correct value from calc element.

Thanks !!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top