Good morning, can someone help me or give me a guide
How can I do this condition?
if the value is <= 4 , print "low" in the condition field
if the value is = 5 , print "normal" in the condition field
if the value is >= 6 , print "height" in the condition field
Attached image
Thank you
special condition
special condition <=>
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: special condition <=>
code note tested
tablename-dv.js -> replace table name for your tablename and put this file inside hooks directory
tablename-dv.js -> replace table name for your tablename and put this file inside hooks directory
Code: Select all
$j(function()){
$j('#field_name').on('change', function(){
if( $j('#field_name').val() <= 4 ){
$j('#another_field').val('low');
}else if( $j('#field_name').val() == 5 ){
$j('#another_field').val('normal');
});
}; // end file
Re: special condition <=>
Thanks...it works.
$j(function(){
$j('#bmc').on('change', function(){
if( $j('#bmc').val() <= 18.5 ){
$j('#condition').val('LOW');
}else if( $j('#bmc').val() >= 18.6 ){
$j('#condition').val('NORMAL');
}
});
})
Thanks...it works...but
Excuse my English,
I am learning to program.
I would like to make a form that gives me the result of
Body Mass Index (BMI)
field_weight
height_field
field_bmi
field_condition
can it be done in the same file tablename-dv.js ?
A guide please!
(If I write the bmi if "condition" appears, but if I generate it automatically with SQL there is no condition)
If you could guide me, thank you.
$j(function(){
$j('#bmc').on('change', function(){
if( $j('#bmc').val() <= 18.5 ){
$j('#condition').val('LOW');
}else if( $j('#bmc').val() >= 18.6 ){
$j('#condition').val('NORMAL');
}
});
})
Thanks...it works...but
Excuse my English,
I am learning to program.
I would like to make a form that gives me the result of
Body Mass Index (BMI)
field_weight
height_field
field_bmi
field_condition
can it be done in the same file tablename-dv.js ?
A guide please!
(If I write the bmi if "condition" appears, but if I generate it automatically with SQL there is no condition)
If you could guide me, thank you.
- Attachments
-
- CONDICION5.png (6.68 KiB) Viewed 1158 times
-
- CONDICION2.png (6.9 KiB) Viewed 1158 times
Luis Ramirez R.
Re: special condition <=>
Sorry for the translation, my language is Spanish.
in the hooks/patient.php table I added this:
and in hooks/patient-dv.js I added this:
(it works but I'm not sure if that's ok)
the problem I have is that when I add the weight and height values it shows me the IMC result when saving, but it does not tell me the condition automatically, so I have to touch the IMC field with the mouse again and save again to that the condition created with a text field appears, option list.
If someone can help me to the condition that is generated automatically when the IMC is displayed.
in the hooks/patient.php table I added this:
function paciente_init(&$options, $memberInfo, &$args) {
if(isset($_REQUEST['SelectedID'])){
$id=makeSafe($_REQUEST['SelectedID']);
sqlvalue("UPDATE paciente set imc=ROUND(`peso` / (`altura` * `altura` )) /2.2");
}
return TRUE;
}
and in hooks/patient-dv.js I added this:
(it works but I'm not sure if that's ok)
$j(function(){
$j('#imc').on('change', function(){
if( $j('#imc').val() <= 18.4){
$j('#condicion').val('BAJO PESO');
}else if( $j('#imc').val() >= 18.6 && $j('#imc').val() <= 24.9 ){
$j('#condicion').val('SALUDABLE');
}else if( $j('#imc').val() >= 25.0 && $j('#imc').val() <= 29.9) {
$j('#condicion').val('SOBRE PESO');
}else if( $j('#imc').val() >= 30.0 && $j('#imc').val() <= 34.9 ){
$j('#condicion').val('OBESIDAD');
}else if( $j('#imc').val() >= 35.0 && $j('#imc').val() <= 39.9) {
$j('#condicion').val('OBESIDAD SEVERA');
}else if( $j('#imc').val() >= 40.0 ) {
$j('#condicion').val('OBESIDAD MORBIDA');
}
});
})
the problem I have is that when I add the weight and height values it shows me the IMC result when saving, but it does not tell me the condition automatically, so I have to touch the IMC field with the mouse again and save again to that the condition created with a text field appears, option list.
If someone can help me to the condition that is generated automatically when the IMC is displayed.
- Attachments
-
- imc1.png (8.12 KiB) Viewed 1044 times
-
- imc5.png (32.95 KiB) Viewed 1044 times
Luis Ramirez R.