Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Magento header.phtml中广播提交_Javascript_Magento_Prototype - Fatal编程技术网

Javascript 在Magento header.phtml中广播提交

Javascript 在Magento header.phtml中广播提交,javascript,magento,prototype,Javascript,Magento,Prototype,Magento v1.7 如何通过侦听单选按钮上的更改来提交header.phtml中的表单 这是我的代码,如果我将单选按钮更改为“选择”下拉列表,则可以提交。我不明白 $groupId = null; if (Mage::getSingleton('customer/session')->isLoggedIn()) { /* Get the customer data */ $customer = Mage::getSingleton('customer/session

Magento v1.7

如何通过侦听单选按钮上的更改来提交header.phtml中的表单

这是我的代码,如果我将单选按钮更改为“选择”下拉列表,则可以提交。我不明白

$groupId = null;
if (Mage::getSingleton('customer/session')->isLoggedIn()) {

    /* Get the customer data */
    $customer = Mage::getSingleton('customer/session')->getCustomer();
    /* Get the customer's full name */
    $customer = Mage::getModel('customer/customer')->load($customer->getId()) ;

    $groupId = $customer->getGroupId();
}
$cookieGroupId = Mage::getModel('core/cookie')->get('customer_group_id');
if ($cookieGroupId) {
    $groupId = $cookieGroupId;
}


?>

<div id="alt-nav-container">
    <ul id="alt-nav">
        <li class="icon-reorder"><span>Navigation</span></li>
    </ul>
</div>
<div class="header-container">
    <header class="header">
        <h1>
            <figure>
                <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><span><?php echo $this->getLogoAlt() ?></span>
                </a>
            </figure>
        </h1>
        <div class="player-container">
            <div id="jquery_jplayer_1" class="jp-jplayer"></div>
            <div id="jp_container_1" class="jp-audio">
                <div class="jp-type-single">
                    <div class="jp-gui jp-interface">
                        <ul class="jp-controls">
                            <li class="control-left"><a href="javascript:;" class="jp-play" tabindex="1"><span class="play-button"></span></a><a href="javascript:;" class="jp-pause" tabindex="1"><span class="pause-button"></span></a></li>
                            <li class="control-center"><strong>Playing: <span class="jp-track-title"></span></strong> by <span class="jp-composer-name"></span></li>
                            <li class="control-right"><a href="javascript:;" class="jp-mute" tabindex="1" title="mute"><span class="volume-on-button"></span></a><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute"><span class="volume-off-button"></span></a></li>
                        </ul>
                        <div class="jp-time-holder">
                            <div class="jp-current-time"></div>
                            <div class="jp-progress">
                                <div class="jp-seek-bar">
                                    <div class="jp-play-bar"></div>
                                </div>
                            </div>
                            <div class="jp-duration"></div>
                        </div>
                    </div>
                    <div class="jp-no-solution">
                        <span>Update Required</span>
                        To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
                    </div>
                </div>
            </div>
        </div>
<!--
<div style="z-index:9999;">
<?php
//    var_export(get_class_methods(get_class($GroupId)));
?>
</div> -->
        <div class="license-type">

            <ul class="select-license-tab">
                <li><span>Select your license type <sub class="icon-chevron-down"></sub></span>
                    <ul>
                        <li>
                            <div class="license-form">
                                <form action="<?php echo $this->getUrl('mcustomer/group/update') ?>" method="post" id="form-group-update" name="form-group-update">
                                    <dl class="accordion">
                                    <?php $groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?>
                                    <?php foreach($groups as $group){ ?>
                                        <div class="license-item">
                                            <dt>
                                                <?php if($groupId != null && $group['value'] == $groupId):?>
                                                    <input id="license-type-<?php print $group['value'] ?>" name="validate-one-required" type="radio" value="<?php print $group['value'] ?>" class="required-entry validate-one-required" checked="checked" />
                                                    <label for="license-type-<?php print $group['value'] ?>"><?php print $group['label'] ?></label>
                                                <?php else: ?>
                                                    <input id="license-type-<?php print $group['value'] ?>" name="validate-one-required" type="radio" value="<?php print $group['value'] ?>" class="required-entry validate-one-required" />
                                                    <label for="license-type-<?php print $group['value'] ?>"><?php print $group['label'] ?></label>
                                                <?php endif; ?>
                                            </dt>
                                            <dd>
                                                <?php print $group['customer_description'] ?>
                                            </dd>
                                        </div>
                                    <?php } ?>
                                    </dl>
                                </form>
                            </div>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </header>
</div>
<div class="navigation-bar">
    <div class="navigation-bar-wrapper">
        <?php echo $this->getChildHtml('topContainer'); ?>
        <?php echo $this->getChildHtml('topSearch') ?>
        <?php echo $this->getChildHtml('topLinks') ?>
        <?php echo $this->getChildHtml('store_language') ?>
        <?php echo $this->getChildHtml('topMenu') ?>
    </div>
</div>
<script type="text/javascript">
//< ![CDATA[
var customForm = new VarienForm('form-group-update');

Event.observe($("validate-one-required"),'change', function(event){
    $('form-group-update').submit();
});

//]]>
</script>

提前感谢

您应该向收音机中添加一个新类,以防止与其他页面上的表单冲突,因为需要验证的类不是唯一的,或者使用更唯一的类选择器,例如$$。许可证表单。需要验证的类。每个

$$('.license-form_radios').each(function(curInput) {
    Event.observe(curInput, 'click', function() {
       $('form-group-update').submit();
    });
});