Hi
Is there a way that I can read or access a field that the user is typing, to incorporate its value in a search?
for example, this is my query for the lookup Sites
SELECT `Sites`.`id`, `Sites`.`Description` FROM `Sites` WHERE `Sites`.`id` NOT IN (SELECT `Reservation`.`SITIO` FROM `Reservation` WHERE `Reservation`.`DATE` = '2023-05-05')
It works fine, but only for the date '2023-05-05'. What I need is to replace this constant for the value than the user is introducing in Reservation.Date at the time of the capture
How can I access/read a field from the input form?
Re: How can I access/read a field from the input form?
Hi,
can you be a bit more specific on how you want this to happen. Shall it be at the time the user enters some data, or when the user saves a record?
In general you can access the entered data via the $_POST, $_GET or $_REQUEST arrays.
If you use the standard Appgini form for date input you will need to gather the 3 fields representing the day, month and year and put them together.
can you be a bit more specific on how you want this to happen. Shall it be at the time the user enters some data, or when the user saves a record?
In general you can access the entered data via the $_POST, $_GET or $_REQUEST arrays.
If you use the standard Appgini form for date input you will need to gather the 3 fields representing the day, month and year and put them together.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How can I access/read a field from the input form?
Hi pböttcher
Yes. It must be before the user saves the record
In this screeen, if the user change the value on field Reserva.Date (Fecha) the lookup query muste change to show only the sites that are not reserved on that date.
So, the field Reserva.Date it is conformed by 3 differente fields in AppGini? How they are named? And, how can I access their valies?
Thanks for your help!
Yes. It must be before the user saves the record
In this screeen, if the user change the value on field Reserva.Date (Fecha) the lookup query muste change to show only the sites that are not reserved on that date.
So, the field Reserva.Date it is conformed by 3 differente fields in AppGini? How they are named? And, how can I access their valies?
Thanks for your help!
Re: How can I access/read a field from the input form?
Update:
Using the following script I can now read the date selected by the user and store it in the Calculated variable
<scritp>
$j(function(){
$j('#Fecha-dd, #Fecha-mm, Fecha').change(function(){
var y = $j('#' + 'Fecha').val();
var m = $j('#' + 'Fecha-mm').val();
var d = $j('#' + 'Fecha-dd').val(); // Reading the data in DV
if (m < 10) {
m = '0' + m; // Formating
}
if (d < 10) {
d = '0' + d; // Formating
}
stfecha = y + '-' + m + '-' + d; // Now stfecha = 'YYYY-MM-DD'
$j('#Calculado').val(stfecha); // Puting stFecha in RESERVAS.CALCULADO (A field in the DV)
});
});
</script>
I made Calculado as a text field in the database, to be able to read it and use it in the next lookup advanced query
But it is not working. In fact, if I put an empty string instead of 'RESERVAS.CALCULADO' the efect is the same
What I'm doing wrong?
Using the following script I can now read the date selected by the user and store it in the Calculated variable
<scritp>
$j(function(){
$j('#Fecha-dd, #Fecha-mm, Fecha').change(function(){
var y = $j('#' + 'Fecha').val();
var m = $j('#' + 'Fecha-mm').val();
var d = $j('#' + 'Fecha-dd').val(); // Reading the data in DV
if (m < 10) {
m = '0' + m; // Formating
}
if (d < 10) {
d = '0' + d; // Formating
}
stfecha = y + '-' + m + '-' + d; // Now stfecha = 'YYYY-MM-DD'
$j('#Calculado').val(stfecha); // Puting stFecha in RESERVAS.CALCULADO (A field in the DV)
});
});
</script>
I made Calculado as a text field in the database, to be able to read it and use it in the next lookup advanced query
But it is not working. In fact, if I put an empty string instead of 'RESERVAS.CALCULADO' the efect is the same
What I'm doing wrong?
Re: How can I access/read a field from the input form?
Ups
In the previous screen, I use `RESERVAS`.`FECHA` = `'RESERVAS`.`CALCULADO`' (with double quote)
I tried also `RESERVAS`.`FECHA` = `RESERVAS`.`CALCULADO` (single quote) but the result is the same
In the previous screen, I use `RESERVAS`.`FECHA` = `'RESERVAS`.`CALCULADO`' (with double quote)
I tried also `RESERVAS`.`FECHA` = `RESERVAS`.`CALCULADO` (single quote) but the result is the same