![]() |
![]() ![]() |
![]() |
-bania- |
![]()
Post
#1
|
Goście ![]() |
Grzebię właśnie w sklepie Virtuemart2 i chciałbym zmienić działanie pola wyboru waluty aby od razu po wybraniu pozycji z listy nastąpiła zmiana bez konieczności wciskania submit.
Chce do tego dodać parametr onchange='this.form.submit()' do tagu SELECT. Menu jest budowane poprzez klasę jhtml, moduł wywołuje ją w taki sposób: Kod <?php // no direct access defined('_JEXEC') or die('Restricted access'); ?> <!-- Currency Selector Module --> <?php echo $text_before ?> <form action="<?php echo JURI::getInstance()->toString(); ?>" method="post"> <br /> <?php echo JHTML::_('select.genericlist', $currencies, 'virtuemart_currency_id', 'class="inputbox"', 'virtuemart_currency_id', 'currency_txt', $virtuemart_currency_id); ?> <input class="button" type="submit" name="submit" value="<?php echo JText::_('MOD_VIRTUEMART_CURRENCIES_CHANGE_CURRENCIES') ?>" /> </form> użyta metoda genericlist: Kod public static function genericlist($data, $name, $attribs = null, $optKey = 'value', $optText = 'text', $selected = null, $idtag = false, $translate = false) { // Set default options $options = array_merge(JHtml::$formatOptions, array('format.depth' => 0, 'id' => false)); if (is_array($attribs) && func_num_args() == 3) { // Assume we have an options array $options = array_merge($options, $attribs); } else { // Get options from the parameters $options['id'] = $idtag; $options['list.attr'] = $attribs; $options['list.translate'] = $translate; $options['option.key'] = $optKey; $options['option.text'] = $optText; $options['list.select'] = $selected; } $attribs = ''; if (isset($options['list.attr'])) { if (is_array($options['list.attr'])) { $attribs = JArrayHelper::toString($options['list.attr']); } else { $attribs = $options['list.attr']; } if ($attribs != '') { $attribs = ' ' . $attribs; } } $id = $options['id'] !== false ? $options['id'] : $name; $id = str_replace(array('[', ']'), '', $id); $baseIndent = str_repeat($options['format.indent'], $options['format.depth']++); $html = $baseIndent . '<select' . ($id !== '' ? ' id="' . $id . '"' : '') . ' name="' . $name . '"' . $attribs . '>' . $options['format.eol'] . self::options($data, $options) . $baseIndent . '</select>' . $options['format.eol']; return $html; } Problem polega na tym że kiedy dodaję do linii modułu <?php echo JHTML::_('select.genericlist', $currencies, 'virtuemart_currency_id', 'class="inputbox"', 'virtuemart_currency_id', 'currency_txt', $virtuemart_currency_id) ; ?> ciąg onchange='this.form.submit()' to w końcowym kodzie na stronie apostrofy są zamieniane na cudzysłowy i kod wygląda tak: Kod <select id="virtuemart_currency_id" name="virtuemart_currency_id" class="inputbox" onchange="this.form.submit()"> Przez to waluta nie zmienia się od razu po wybraniu pozycji z menu. Jak zrobić aby apostrofy się nie zamieniały? |
|
|
![]()
Post
#2
|
|
Grupa: Moderatorzy Postów: 15 467 Pomógł: 1451 Dołączył: 25.04.2005 Skąd: Szczebrzeszyn/Rzeszów ![]() |
Uhm, i z tego powodu jest problem?
|
|
|
-bania- |
![]()
Post
#3
|
Goście ![]() |
tak mi się wydaje, bo jak zamieniam ręcznie w chrome cudzysłowy na apostrofy to wtedy działa.
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 15:53 |