Post by nicklas » Tue May 09, 2017 3:09 pm

I want to get the following to radio buttons instead of drop down.
I'm not sure how to do it. I would appreciate if someone could help me out :)

Code: Select all

<h2><?php echo $text_title; ?></h2>
<p><?php echo $text_description; ?></p>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
    <?php if ($type === 'SELECT'): ?>
        <p>
            <label for="factoring-menu"><?php echo $text_select_payment_method; ?></label>
            <select name="factoring-menu" id="factoring-menu" class="required-entry">
                <option selected value="FINANCING"><?php echo $text_financing_invoice; ?></option>
                <option value="CREDITACCOUNT"><?php echo $text_part_payment; ?></option>
            </select>
        </p>
    <?php endif; ?>
    <label for="social-security-number"><?php echo $text_social_security_number; ?></label>
    <input type="text" name="social-security-number" id="social-security-number" value="" autocomplete="off">
</form>
<div class="buttons">
    <div class="right">
        <input type="button" value="<?php echo $button_confirm; ?>" id="button-confirm" class="button"/>
    </div>
</div>
<script type="text/javascript">
    <!--
    $('#button-confirm').bind('click', function () {
		$(this).prop('disabled', true);
        $.ajax({
            url: '<?php echo html_entity_decode($action, ENT_QUOTES, 'UTF-8'); ?>',
            type: 'POST',
            cache: false,
            async: true,
            dataType: 'json',
            data: {
                'social-security-number': $('#social-security-number').val()
            },
			error:function(){
				$('#button-confirm').prop('disabled',false);
			},
            success: function (response) {
				$('#button-confirm').prop('disabled',false);
				if (response.status !== 'ok') {
                    if ($('#payex-error').is('*')) {
                        $('#payex-error').html(response.message);
                    } else {
                        $('<div id="payex-error" class="warning">' + response.message + '</div>').insertBefore('#form');
                    }
                    return false;
                }

                $(this).attr('disabled', 'disabled');
                $('#payex-error').remove();
                $('#form').get(0).setAttribute('action', response.redirect);
                setTimeout(function() {
                    $('#form').submit();
                }, 1000);
            }
        });
    });
    //-->
</script>

New member

Posts

Joined
Wed Mar 15, 2017 7:14 pm

Post by kestas » Tue May 09, 2017 4:04 pm

Try this:

Code: Select all

<h2><?php echo $text_title; ?></h2>
<p><?php echo $text_description; ?></p>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
    <?php if ($type === 'radio'): ?>
	
	        <p>
            <label for="factoring-menu"><?php echo $text_select_payment_method; ?></label>
            <input  type="radio" name="factoring-menu" id="factoring-menu" class="required-entry" value="FINANCING" checked="checked"/><?php echo $text_financing_invoice; ?><br /> 
            <input  type="radio" name="factoring-menu" id="factoring-menu" class="required-entry" value="CREDITACCOUNT"/><?php echo $text_part_payment; ?>            
           </p>
    <?php endif; ?>
    <label for="social-security-number"><?php echo $text_social_security_number; ?></label>
    <input type="text" name="social-security-number" id="social-security-number" value="" autocomplete="off">
</form>
<div class="buttons">
    <div class="right">
        <input type="button" value="<?php echo $button_confirm; ?>" id="button-confirm" class="button"/>
    </div>
</div>
<script type="text/javascript">
    <!--
    $('#button-confirm').bind('click', function () {
		$(this).prop('disabled', true);
        $.ajax({
            url: '<?php echo html_entity_decode($action, ENT_QUOTES, 'UTF-8'); ?>',
            type: 'POST',
            cache: false,
            async: true,
            dataType: 'json',
            data: {
                'social-security-number': $('#social-security-number').val()
            },
			error:function(){
				$('#button-confirm').prop('disabled',false);
			},
            success: function (response) {
				$('#button-confirm').prop('disabled',false);
				if (response.status !== 'ok') {
                    if ($('#payex-error').is('*')) {
                        $('#payex-error').html(response.message);
                    } else {
                        $('<div id="payex-error" class="warning">' + response.message + '</div>').insertBefore('#form');
                    }
                    return false;
                }

                $(this).attr('disabled', 'disabled');
                $('#payex-error').remove();
                $('#form').get(0).setAttribute('action', response.redirect);
                setTimeout(function() {
                    $('#form').submit();
                }, 1000);
            }
        });
    });
    //-->
</script>

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by nicklas » Sat May 13, 2017 6:31 pm

Thank you for your input but that didn't work :( Getting no options what so ever with that replacement code.

New member

Posts

Joined
Wed Mar 15, 2017 7:14 pm

Post by kestas » Sun May 14, 2017 3:54 pm

I am sorry to hear that. Not having a full environment I just change the code without being able to run or debug it. If you need help please send me whole extension to me in PM. I'll check it.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: No registered users and 8 guests