Hello
please first see this URL:
http://146.255.185.182/~traductores/design2/index.php?option=com_chronoforms5&chronoform=pedido_online_traduccion&lang=es
Inside this form i get data from table db inside dropdown list: value = ID (table), text = column "idioma" in DB.
I need get data array depend value dropdown and pass in to hidden fields. Example:
I select: "Alemán" value dropdown is 31 (id table) then i need get array [0] (from Model "ReadIdiomas") and pass values inside fields:
precio_delespañol_oculto (hidden field) value = ReadIdiomas[0][delespanol] => 0,12
precio_alespañol_oculto (hidden field) value = ReadIdiomas[0][alespanol] => 0,10
precio_minimo_oculto (hidden field) value = ReadIdiomas[0][preciominimo] => 37
later, with this values i need to make operation matematical on submit but I think this can do the fields are filled of data.
i have javascrip load (for field test)
window.addEvent('domready', function() {
$('Idioma_Origen').addEvent('change', function(){
var mytexts = $('Idioma_Origen').get('value');;
$('seleccion').set('value', mytexts);
});
});
For pass value dropdown in a field text test... but not how to access data in javascript.
Not if I could explain it clearly. It is very difficult not knowing English.
postData:
I see many examples in this forum, or tutorials, but but I have not managed to adapt to my specific need
If u need admin pass send me a email private for this.
TVM!!
Javierp.
please first see this URL:
http://146.255.185.182/~traductores/design2/index.php?option=com_chronoforms5&chronoform=pedido_online_traduccion&lang=es
Inside this form i get data from table db inside dropdown list: value = ID (table), text = column "idioma" in DB.
I need get data array depend value dropdown and pass in to hidden fields. Example:
I select: "Alemán" value dropdown is 31 (id table) then i need get array [0] (from Model "ReadIdiomas") and pass values inside fields:
precio_delespañol_oculto (hidden field) value = ReadIdiomas[0][delespanol] => 0,12
precio_alespañol_oculto (hidden field) value = ReadIdiomas[0][alespanol] => 0,10
precio_minimo_oculto (hidden field) value = ReadIdiomas[0][preciominimo] => 37
later, with this values i need to make operation matematical on submit but I think this can do the fields are filled of data.
i have javascrip load (for field test)
window.addEvent('domready', function() {
$('Idioma_Origen').addEvent('change', function(){
var mytexts = $('Idioma_Origen').get('value');;
$('seleccion').set('value', mytexts);
});
});
For pass value dropdown in a field text test... but not how to access data in javascript.
Not if I could explain it clearly. It is very difficult not knowing English.
postData:
I see many examples in this forum, or tutorials, but but I have not managed to adapt to my specific need
If u need admin pass send me a email private for this.
TVM!!
Javierp.
Hi Javierp.,
Why do you need to get this data using JavaScript? If you don't need it until after the form submits then you can look it up then?
If you need to do it in the browser then it is possible using JavaScript and Ajax to send a query back to the server.
Bob
PS The JavaScript you posted looks as if it is using the MooTools library; Joomla 3 and CFv5 both use the jQuery library.
Why do you need to get this data using JavaScript? If you don't need it until after the form submits then you can look it up then?
If you need to do it in the browser then it is possible using JavaScript and Ajax to send a query back to the server.
Bob
PS The JavaScript you posted looks as if it is using the MooTools library; Joomla 3 and CFv5 both use the jQuery library.
HI.
I do not care to use javascript, ajax, jquery or anything. All I need is access to array operations "onsubmit" with them. Can you give me an example of how to access them so dynamic?
Do not know how to access the data.
(I'm not a programmer but I defend, their software is great and almost never need to use custom code, but this time not how)
Thousand thanks.
I do not care to use javascript, ajax, jquery or anything. All I need is access to array operations "onsubmit" with them. Can you give me an example of how to access them so dynamic?
Do not know how to access the data.
(I'm not a programmer but I defend, their software is great and almost never need to use custom code, but this time not how)
Thousand thanks.
Hello Again... Nothing to help me?
I need help to access the array, then assign variables to the hidden fields. Then submitting the form I want to manage the data and make a sum of variables.
TYVM
javierp
I need help to access the array, then assign variables to the hidden fields. Then submitting the form I want to manage the data and make a sum of variables.
TYVM
javierp
Hi javierp,
Sorry, but I don't understand what you are trying to do here. What is the problem you are trying to solve?
Bob
Sorry, but I don't understand what you are trying to do here. What is the problem you are trying to solve?
Bob
OK, I try to explain myself better now.
In the URL (form test)
http://146.255.185.182/~traductores/design2/index.php?option=com_chronoforms5&chronoform=pedido_online_traduccion&lang=es
I have droped a module debugger so that you can see the data that I bring with dbRead
You can check that extract an Array called [ReadIdiomas] which, in turn, contains five variables:
(this vars is the table inside DB)
the var "idioma" is the text in dropdown and checkbox group. The value text dropdown is "id"
Now, i need asign value [delespanol], [alespanol] and [preciominimo] to value hide fields when i select dropdown respective. Ex: if i select text=1 value id=1 i need [delespanol][id=1], [alespanol][id=1] and [preciominimo][id=1]
These data need to pass them to hidden fields and then perform a mathematical operation with them.
hideField1 + hideField2 / hideField2 = total
It is understood now?
Sorry, my English is a mixture of Google translator and my little knowledge.
No matter if used ajax, javascript or php.
Would need a small example code
In the URL (form test)
http://146.255.185.182/~traductores/design2/index.php?option=com_chronoforms5&chronoform=pedido_online_traduccion&lang=es
I have droped a module debugger so that you can see the data that I bring with dbRead
You can check that extract an Array called [ReadIdiomas] which, in turn, contains five variables:
[id] => xxx
[idioma] => xxx
[delespanol] => xxx
[alespanol] => xxx
[preciominimo] => xxx
(this vars is the table inside DB)
the var "idioma" is the text in dropdown and checkbox group. The value text dropdown is "id"
Now, i need asign value [delespanol], [alespanol] and [preciominimo] to value hide fields when i select dropdown respective. Ex: if i select text=1 value id=1 i need [delespanol][id=1], [alespanol][id=1] and [preciominimo][id=1]
These data need to pass them to hidden fields and then perform a mathematical operation with them.
hideField1 + hideField2 / hideField2 = total
It is understood now?
Sorry, my English is a mixture of Google translator and my little knowledge.
No matter if used ajax, javascript or php.
Would need a small example code
Hello?
I tried to explain. It is clear now? can anybody help me?
thanks!
javierp.
I tried to explain. It is clear now? can anybody help me?
thanks!
javierp.
Hi jhaviro,
And what do you want to do with the total?
The simplest way to do this is to put the DB Read in the On Submit event of your form, then use PHP in a Custom Code action to do the calculations you need.
That should add the values you want to the data array so that you can do something else with them.
Bob
And what do you want to do with the total?
The simplest way to do this is to put the DB Read in the On Submit event of your form, then use PHP in a Custom Code action to do the calculations you need.
<?php
foreach ( $form->data['ReadIdiomas'] as $k => $v ) {
if ( !empty($form->data['idioma_destino'][$v['id']] ) {
$form->data['ReadIdiomas'][$k]['total'] = $v['delespanol'] + $v['alespanol'] / $v['preciominimo'];
} else {
unset($form->data['ReadIdiomas'][$k]);
}
}
?>
!! not tested and may need debugging !!
That should add the values you want to the data array so that you can do something else with them.
Bob
I tried to explain what I do in simplified form but not the operation of the form: I try to explain better:
Dropdown ("source language")
Select "Text = Spanish" value (id) = 49;
When I select I want the variables:
"delespanol" = 0;
Then I go to the checkbox ("target language") and select "Bulgarian" value id = 20
When I select I want the variables:
"alespanol" = 0.30;
Finally, I go to the field "n_palabras" and writing "40"
On submit button:
"delespanol" + "alespanol" * "NO. Word" = total
0 + 0.30 * 40 = 12;
as variable names:
DATA"delespañol" + DATA"alespanol" * FIELD "n_palabras" = FIELD "total"
(Values are fictitious, it is a clearer example)
in this url: http://www.traductores.com/publico/B2C/b2c.htm
there is a similar form. I changed the kind of language selection by checkboxes. The calculation is the same: rate source language target language + rate multiplied by number of words.
I want to replicate that form with chornoform.
Dropdown ("source language")
Select "Text = Spanish" value (id) = 49;
When I select I want the variables:
"delespanol" = 0;
Then I go to the checkbox ("target language") and select "Bulgarian" value id = 20
When I select I want the variables:
"alespanol" = 0.30;
Finally, I go to the field "n_palabras" and writing "40"
On submit button:
"delespanol" + "alespanol" * "NO. Word" = total
0 + 0.30 * 40 = 12;
as variable names:
DATA"delespañol" + DATA"alespanol" * FIELD "n_palabras" = FIELD "total"
(Values are fictitious, it is a clearer example)
in this url: http://www.traductores.com/publico/B2C/b2c.htm
there is a similar form. I changed the kind of language selection by checkboxes. The calculation is the same: rate source language target language + rate multiplied by number of words.
I want to replicate that form with chornoform.
I think I'm asking too much help ... maybe if I make concrete questions is easier, then I try to do it:
1. as I can access the event "onselect" a dropdown
2. As asigbo a variable "data" to a form field?
3. How can I create a function to OnSubmit
I do not like that you waste your time with me, I need a little help, I do not want to bother.
1. as I can access the event "onselect" a dropdown
2. As asigbo a variable "data" to a form field?
3. How can I create a function to OnSubmit
I do not like that you waste your time with me, I need a little help, I do not want to bother.
Hi Javierp,
Thank you - that makes it clearer,
Do you want people to be able to select more than one 'Idiomas destino' ? If only one then you can use radio buttons.
Bob
Thank you - that makes it clearer,
Do you want people to be able to select more than one 'Idiomas destino' ? If only one then you can use radio buttons.
Bob
hello again (im online, this is important for me)
Indeed, the user should be able to select more than one target language.
That is the reason for using checkbox
Indeed, the user should be able to select more than one target language.
That is the reason for using checkbox
write again please a helpme.
1 question concrete, (please i need "general" example):
how asign data array to hidden fields onchange select dropdown in custom javascript?
thaks again
1 question concrete, (please i need "general" example):
how asign data array to hidden fields onchange select dropdown in custom javascript?
thaks again
hello again.
I found a bad solution using javascript.
I have inserted all the data in several hidden fields dropdown list and from there I used javascript to access the value of each option.
It is not a "clean" solution but not how to do it with ajax.
tyvm for your time and try help me.
javierp.
I found a bad solution using javascript.
I have inserted all the data in several hidden fields dropdown list and from there I used javascript to access the value of each option.
It is not a "clean" solution but not how to do it with ajax.
tyvm for your time and try help me.
javierp.
Hi Javierp,
That sounds like a good solution to me. You could just load all your data as a JSON encoded array in one hidden elemetn and look up what you need from the array.
Bob
That sounds like a good solution to me. You could just load all your data as a JSON encoded array in one hidden elemetn and look up what you need from the array.
Bob
hi Bob
I would have liked to load the dynamic Array so to avoid having to load all the data at once. In this case it does not matter much because few data for large tables but no solution that I can give.
I can handle javascript to well everything, but I have not the slightest idea of using Ajax.
I would have liked to load the dynamic Array so to avoid having to load all the data at once. In this case it does not matter much because few data for large tables but no solution that I can give.
I can handle javascript to well everything, but I have not the slightest idea of using Ajax.
This topic is locked and no more replies can be posted.