hi,
this code:
[PHP]
foreach($this->cart->BTaddress["fields"] as $singlefield) {
if($singlefield['formcode'] != "")
{
if(in_array($singlefield['name'],$skipped_fields_array)) {
continue;
}
echo "<div class='opg-width-1-1'>";
if($singlefield['type'] == "select")
{
echo '<label class="' . $singlefield['name'] . '" for="' . $singlefield['name'] . '_field">';
echo $singlefield['title'] . ($singlefield['required'] ? ' *' : '');
echo '</label><br />';
}
else if($singlefield['type'] == "checkbox")
{
$singlefield['formcode']= '<label>'.$singlefield["formcode"].$singlefield["title"].'</label>';
}
else
{
$singlefield['formcode']=str_replace('<input','<input placeholder="'.$singlefield['title'].'"' ,$singlefield['formcode']);
$singlefield['formcode']=str_replace('size="30"','' ,$singlefield['formcode']);
}
if($singlefield['name'] == "email")
{
$singlefield['formcode'] = '<div id ="email_error" class="opg-width-1-1 style="display:none;"></div>'.$singlefield['formcode'];
$singlefield['formcode'] = str_replace('<input','<input onblur="checkemail();" ', $singlefield['formcode']);
}
if($singlefield['name']=='zip') {
$ajaxzip = $onlyguest = $params->get('ajax_zip',0);
if($ajaxzip)
{
$replacetext = 'input onchange="javascript:updateaddress(3);"';
}
else
{
$replacetext = 'input ';
}
$singlefield['formcode']=str_replace('input', $replacetext ,$singlefield['formcode']);
}
else if($singlefield['name']=='title') {
$singlefield['formcode']=str_replace('vm-chzn-select','',$singlefield['formcode']);
}
###### MODIFIC LAYOYT ##############
if($singlefield['type'] == "radio")
{
if ($singlefield['name']==0){
echo $singlefield['name'];
}
}
if($singlefield['name']=='company')
{
echo "You are a business:";
}
if($singlefield['name']=='vies_registration')
{
echo "You are a business:";
}
###### MODIFIC LAYOYT ##############
echo $singlefield['formcode'];
echo '</div>';
}
}
[/PHP
in the part of code "MODIFY LAYUOT"...
I want to place two radio buttons Yes / No (required field) to show or hide two fields COMPANY AND VIES Registration
I can not understand how to intercept from foreach the two fields COMPANY AND VIES Registration to insert them into a DIV that allows me to do this
thanks to everyone for support and suggestions
hi,
I tried to change this way too, but it does not work ...
if($singlefield['type'] == "radio")
{
echo "Register as a Business";
echo $singlefield['formcode'];
foreach($this->cart->BTaddress["fields"] as $singlefield) {
if($singlefield['formcode'] != "")
{
if(in_array($singlefield['name'],$skipped_fields_array)) {
continue;
}
}
if($singlefield['name']=='company'){
echo "Company name ". $singlefield['formcode'];
}
if($singlefield['name']=='vies_registration'){
echo "VIES REGISTRATION ". $singlefield['formcode'];
}
}
}
thanks you
hi,
problem solved
This funcion ..
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type='text/javascript'>
// <![CDATA[
jQuery(document).ready(function(){
$('input:radio[name="fatt_si_no"]').change(function(){
if($(this).val() == '1'){
if( $('#hide').css('display') == 'block' )
$('#hide').css('display','none');
else
$('#hide').css('display','block');
return false;
}
if($(this).val() == '0'){
if( $('#hide').css('display') == 'block' )
$('#hide').css('display','none');
else
$('#hide').css('display','block');
return false;
}
});
});
// ]]>
</script>
Bye