Hi,
I feel for my English but it is distressing that this is a translation from Google, because I'm not very good with the language.
I have Chrono Forms 3.1, and I have a form to select a value generated by another table, code:
All this within HTML Form, it works and I am generating the dropdown and now comes my question. Within server side validation, but I want to modify another table with reference to the selected value of dropdown. That is, my question is how to get the selected value (which does not modify any table) to references in the query?
The Server side validation code is:
Thanks!
I feel for my English but it is distressing that this is a translation from Google, because I'm not very good with the language.
I have Chrono Forms 3.1, and I have a form to select a value generated by another table, code:
<select class="cf_inputbox validate-selection" id="select_0" size="1" title="" name="select_0">
<option value="">Choose Option</option>
<?php
jimport ( 'joomla.database.database');
$db =& JFactory::getDBO();
$query = "SELECT name FROM jos_chronoforms_pruebaRegistro";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row){
?><option value="<? echo $row->name?>"> <? echo $row->name ?> </option> <? }
?></select>
All this within HTML Form, it works and I am generating the dropdown and now comes my question. Within server side validation, but I want to modify another table with reference to the selected value of dropdown. That is, my question is how to get the selected value (which does not modify any table) to references in the query?
The Server side validation code is:
<?php
jimport ( 'joomla.database.database');
$db =& JFactory::getDBO();
$param = ??????????????????;
$query = "UPDATE jos_chronoforms_pruebaRegistro SET activo = '1' WHERE name = ".$param."";
$db->setQuery($query);
$db->query();
?>
Thanks!
I tried with and with getVar GetString and I do not work with any. I thought that maybe it does not work as I do not want that this form together with any table, and only modifies a field of one of them because I do not recognize the JRequest:: getVar or GetString. Now I can not think what else to do.
Hola mismamentetu2009,
Put this in the OnSubmit After box (not in server side validation)
Bob
Put this in the OnSubmit After box (not in server side validation)
<?php
// jimport ( 'joomla.database.database'); <-- not required
$db =& JFactory::getDBO();
$param = JRequest::getVar('select_0', '', 'post');
if ( $param ) {
$query = "
UPDATE `#__chronoforms_pruebaRegistro`
SET `activo` = '1'
WHERE `name` = '".$param."' ";
}
$db->setQuery($query);
$db->query();
?>
Bob
Thank you very much for responding so quickly,
but I do not understand very well how to put it into OnSubmit after box.
If you are referring to the Form Code tab, Code On Submit - After Sending email not working. I do not know where to put the code.
Sorry for being such a novice, and thanks again for an answer.
but I do not understand very well how to put it into OnSubmit after box.
If you are referring to the Form Code tab, Code On Submit - After Sending email not working. I do not know where to put the code.
Sorry for being such a novice, and thanks again for an answer.
Hi mismamentetu2009,
Yes, that's the right box to put the code in. Click the blue +- to open the box.
Bob
Yes, that's the right box to put the code in. Click the blue +- to open the box.
Bob
Hi Bob,
I'm sorry but I have done what you said you want me, and it does not work, I even tried to put the table name and not as jos_.
I'm sorry but I have done what you said you want me, and it does not work, I even tried to put the table name and not as jos_.
My form just has a dropdown and a submit is, that is not linked to any table and do not send any email, perhaps it is because it is linked with the board jos_chronosforms_pruebaRegistro.
Hi Bob,
Here is a form of backup. The field name is changed by name and also give you a form backuo of pruebaRegistro.
Thank you.
Here is a form of backup. The field name is changed by name and also give you a form backuo of pruebaRegistro.
Thank you.
Since I discovered the error, was the name of the field. Sorry.
Thank you very much Bob.
Thank you very much Bob.
This topic is locked and no more replies can be posted.