我正在尝试修改一个joomla组件,更具体的是一个包含单选按钮的问卷。在php文件中,代码是:
<form id="form-table" action="<?php echo JRoute::_('index.php?option=com_bisbas&task=table.save'); ?>" method="post" class="form-validate" enctype="multipart/form-data" target="iframe1">
<ul>
<input type="hidden" name="jform[id]" value="<?php echo $this->item->id; ?>" />
<input type="hidden" name="jform[state]" value="<?php echo $this->item->state; ?>" />
<?php echo $this->form->getInput('timecreated'); ?> <div class="control-group"><br><br><br>
<div class="control-label"><?php echo $this->form->getLabel('question1'); ?></div>
<div class="controls"><?php echo $this->form->getInput('question1'); ?></div><br><br>
并且在firebug代码中是:
<div class="controls">
<fieldset id="jform_question1" class="radio" aria-required="true" required="">
<input id="jform_question10" type="radio" aria-required="true" required="" value="Yes" name="jform[question1]">
<label for="jform_question10">Yes</label>
<input id="jform_question11" type="radio" value="No" name="jform[question1]">
<label for="jform_question11">No</label>
<input id="jform_question12" type="radio" value="I am not sure" name="jform[question1]">
<label for="jform_question12">I am not sure</label>
</fieldset>
</div
我希望当用户点击单选按钮的答案来检查值并打印警报时。但我不知道如何在PHP文件中这样做。我明白了
<div class="controls"><?php echo $this->form->getInput('question1'); ?></div>
根据包含值的xml文件打印无线电值但是如何获取它们并在用户选择它时检查值?
答案 0 :(得分:0)
如果我很好理解您的查询,我认为您必须使用javascript 如果您的Joomla版本高于3.0,您可以使用jQuery:
jQuery('#radio_selector').on('click', function(){//verification script});