Can i customize and add field "name as on card " - moodle

can we add field "name as on card" in moodle square payment plugin, on billing information from?
In the API and example, I found the only options for :
card number,
cvv,
exp,
postal code
<form id="nonce-form" novalidate action="process-payment" method="post">
<fieldset>
<div id="sq-card-number"></div>
<div class="third">
<div id="sq-expiration-date"></div>
</div>
<div class="third">
<div id="sq-cvv"></div>
</div>
<div class="third">
<div id="sq-postal-code"></div>
</div>
</fieldset>
<button id="sq-creditcard" class="button-credit-card" onclick="onGetCardNonce(event)">Pay $1.00</button>
<!--
After a nonce is generated it will be assigned to this hidden input field.
-->
<input type="hidden" id="card-nonce" name="nonce">
</form>
I want to add a new form field "Name as on card" in the square payment form.
can anybody please give some example or any help?

Related

Stripe Form Error The 'exp_month' parameter should be an integer (instead, is undefined) and custom form questions

First off, I'm a newbie in all this so forgive me if I may have to ask a lot of questions.
I'm working on a Stripe Payment form. I basically copied and pasted the sample code, changing some entries based on how I understood it. I have several concerns/questions:
The error "The 'exp_month' parameter should be an integer (instead, is undefined). I checked my code and made sure that I followed the suggested solution to others' issue similar to this error. I believe I have everything in order but I'm still getting the issue.
Before this issue, I was able to submit transactions in testing environment but I'm not seeing them on the log section of Stripe's Dashboard. Is there anything missing on my codes?
I need help in being able to capture name, address, phone number, email address. I added entry fields on the form, but the data are not recorded. Please help me on this as well.
I'm sharing the codes I'm currently using:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Purchase 1-On-1 Private Photography Course</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
// This identifies your website in the createToken call below
Stripe.setPublishableKey('Stripe Test Publishable Key');
var stripeResponseHandler = function(status, response) {
var $form = $('#payment-form');
if (response.error) {
// Show the errors on the form
$form.find('.payment-errors').text(response.error.message);
$form.find('button').prop('disabled', false);
} else {
// token contains id, name, last4, and card type
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken" />').val(token));
// and re-submit
$form.get(0).submit();
}
};
jQuery(function($) {
$('#payment-form').submit(function(e) {
var $form = $(this);
// Disable the submit button to prevent repeated clicks
$form.find('button').prop('disabled', true);
Stripe.card.createToken($form, stripeResponseHandler);
// Prevent the form from submitting with the default action
return false;
});
});
Stripe.card.createToken({
name: $('.customer-name').val(),
address_line1: $('.address- line1').val(),
address_line2: $('.address-line2').val(),
address_city: $('.city-address').val(),
address_state: $('.state-address').val(),
address_zip: $('.address-zip').val(),
email: $('.customer-email').val(),
phone_number: $('.phone-number').val(),
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),
exp_year: $('.card-expiry-year').val()
},
stripeResponseHandler);
</script>
</head>
<body>
<h1>Purchase 1-On-1 Private Photography Course</h1>
<form action="" method="POST" id="payment-form">
<span class="payment-errors"></span>
<div class="form-row">
<label>
<span>Name</span>
<input type="text" size="30" data-stripe="name"/>
</label>
</div>
<div class="form-row">
<label>
<span>Address Line 1</span>
<input type="text" size="20" data-stripe="address_line1"/>
</label>
<label>
<span>Address Line 2</span>
<input type="text" size="20" data-stripe="address_line2"/>
</label>
</div>
<div class="form-row">
<label>
<span>City</span>
<input type="text" size="15" data-stripe="address_city"/>
</label>
<label>
<span>State</span>
<input type="text" size="2" data-stripe="address_state"/>
</label>
<label>
<span>Zip</span>
<input type="text" size="5" data-stripe="address_zip"/>
</label>
</div>
<div class="form-row">
<label>
<span>Email</span>
<input type="text" size="20" data-stripe="email"/>
</label>
</div>
<div class="form-row">
<label>
<span>Phone Number</span>
<input type="text" size="20" data-stripe="phone_number"/>
</label>
</div>
<div class="form-row">
<label>
<span>Card Number</span>
<input type="number" size="20" data-stripe="number"/>
</label>
</div>
<div class="form-row">
<label>
<span>CVC</span>
<input type="text" size="4" data-stripe="cvc"/>
</label>
</div>
<div class="form-row">
<label>
<span>Expiration (MM/YYYY)</span>
<input type="number" size="2" data-stripe="exp_month"/>
</label>
<span> / </span>
<input type="number" size="4" data-stripe="exp_year"/>
</div>
<h2>Upon submitting your payment, you will be charged AUD20.00</h2>
<button type="submit">Submit Payment</button>
</form>
</body>
</html>
It looks like you may have combined incompatible code from old tutorials and new tutorials, but it's easy enough to fix!
All the val() calls you're passing to createToken will return an undefined value. You're using class accessors (i.e. looking for a DOM element with class of address-line1), but none of your form fields have a class attribute; they're using data attributes.
You'll instead want to look the fields up via their data-stripe attribute:
Stripe.card.createToken({
name: $('input[data-stripe=name]').val(),
address_line1: $('input[data-stripe=address-line1]').val(),
// etc.
While you're making this change, also double-check that you're using the same data-stripe value in both the form and the jQuery selector—right now there are several places where the two don't match. For example, the form uses address_line1 while your jQuery looks for address-line1.

Form submit from Bootstrap 3 and JSP get parameter

I'm new to Bootstrap. But I'm pretty familiar with HTML. The thing is I cannot get parameter values from JSP. The parameters are from HTML page with Bootstrap 3. Here're the code. I don't understand. If I make simple html only page, then I could get the parameters.
<form class="form-horizontal" method="POST" action="makeResv.jsp">
<div class="container">
<div class="row">
<div class="control-group col-md-5">
<label for="checkIn">date1</label>
<div id="date-container">
<div class="input-group date">
<input type="text" id="checkIn" class="form-control"><span
class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
<div class="control-group col-md-5">
<label for="checkOut">date2</label>
<div id="date-container">
<div class="input-group date">
<input type="text" id="checkOut" class="form-control"><span
class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-success">search</button>
</div>
</div>
</div>
</form>
In a JSP page, I'm just doing the following.
String checkIn = request.getParameter("checkIn");
String checkOut = request.getParameter("checkOut");
out.println(checkIn + " " + checkOut);
What's wrong with the above HTML code with Bootstrap?? Please give me some advise. Thanks!!
BTW, I'm using datepicker JavaScript library, but I don't think that affect the results. I cannot add the library code here but it works great anyway.
https://github.com/eternicode/bootstrap-datepicker
Bootstrap is same as HTML. The problem you are having is because you do not have any name attribute defined in your input element. You define id but to access submited variables via POST (request.getParameter() function) you need to have name attribute defined:
Replace <input> lines like this:
<input type="text" name="checkIn" id="checkIn" class="form-control">
And
<input type="text" name="checkOut" id="checkOut" class="form-control"><

Some fields of a form in foundation reveal

I wish to display some fields of my form in foundation reveal along with the submit button.
Something like:
<form action="" method="POST">
{% csrf_token %}
<div class="large-8 columns">
<input type="text" name="name" label="name"></input>
</div>
Submit
<div id="display_detail" class="reveal-modal" data-reveal>
<input type="text" name="age" label="name"></input>
<input type="submit" value="Submit" class="button">
</div>
</form>
But when the link "Submit" is clicked, I see that the reveal-data div is actually put outside the form. How can this be rectified?
To make sure the Reveal modal actually hovers above the page, and not within some relatively positioned element, it is necesary to move the html to the top level body element.
To deal with this I didn't try to hack into the Reveal plugin to stop this behaviour, instead I added an event listener to a new form that duplicated the entries:
<form action="" method="POST" id="baseform">
{% csrf_token %}
<div class="large-8 columns">
<input type="text" name="name" label="name"></input>
</div>
Submit
<div>
<!-- preferably hide this block using JS -->
<input type="text" name="age" label="name"></input>
<input type="submit" value="Submit" class="button">
</div>
</form>
<div id="display_detail" class="reveal-modal" data-reveal>
<form data-linked-form="baseform">
<input type="text" name="age" label="name"></input>
<input type="submit" value="Submit" class="button">
</form>
</div>
Then using coffeescript:
# duplicate values
$(document).on('input', 'form[data-linked-form]', (e)->
form = e.currentTarget
input = e.target
document.forms[form.dataset.linkedForm].elements[input.name].value = input.value
)
# submit the linked form, instead of itself
$(document).on('sumit', 'form[data-linked-form]', (e)->
form = e.target
document.forms[form.dataset.linkedForm].submit
)

Setting the label next to a textbos without using tables HTML\CSS

I am doing a website for my personal use. I need some assistant on how to set a text-box next to a label without using tables. They are in their own division tags
<div id="outter">
<div class="1">
Fill out and submit the form below and we will contact you a.s.a.p.
</div>
<div class="2">
<label> Name: </label>
</div>
<div class="2">
<input name="name" type="text" class="3" >
</div>
</div>
trying to get this:
[input box 1] label 1
[input box 2] label 2
here is the link for better details
http://homework.genesee.edu/~dmead1/forms/table.html
Very Simple Solution Of Your Problem
HTML
<fieldset class="login">
<legend>Fill out and submit the form below and we will contact you a.s.a.p. </legend>
<div><label for="name">Name</label> <input type="text" id="name" name="name"></div>
</fieldset>
CSS
fieldset div {
margin:0.3em 0;
clear:both;
}
Check Fiddle

Whats wrong with my contact form?

Could someone please take a look at my website's code and tell me why my contact form isnt working?
Here are the relevant portions of code:
From the contact.html file:
<h3 class="indent-bot2">Contact Form</h3>
<form action="#" id="contact-form">
<div class="success"> Contact form submitted!<br>
<strong>We will be in touch soon.</strong> </div>
<fieldset>
<label class="name">
<input type="text" value="Enter Your Name:">
<span class="error">*This is not a valid name.</span>
<span class="empty">*This field is required.</span> </label>
<label class="email">
<input type="text" value="Enter Your E-mail:">
<span class="error">*This is not a valid email address.</span>
<span class="empty">*This field is required.</span> </label>
<label class="phone">
<input type="tel" value="Enter Your Phone:">
<span class="error">*This is not a valid phone number.</span>
<span class="empty">*This field is required.</span> </label>
<label class="message">
<textarea>Enter Your Message:</textarea>
<span class="error">*The message is too short.</span>
<span class="empty">*This field is required.</span> </label>
<div class="buttons-wrapper">
<a class="button" data-type="reset">Clear</a>
<a class="button" data-type="submit">Send</a>
</div>
</fieldset>
</form>
Also from the contact.html file:
<script type="text/javascript">
$(window).load(function(){
$('.slider')._TMS({
duration:800,
easing:'easeInCirc',
preset:'zabor',
pagination:false,
slideshow:7000,
banners:'fromTop',
nextBu:'.next',
prevBu:'.prev',
waitBannerAnimation:false,
pauseOnHover:true,
beforeAnimation:function(){
$('.slider .prev')
.stop()
.animate({top:'425px'},300,'easeOutCirc')
$('.slider .next')
.stop()
.animate({top:'425px'},300,'easeOutCirc')
},
afterAnimation:function(){
$('.slider .prev')
.css({top:'425px'})
.stop()
.animate({top:'327px'},300,'easeOutCirc')
$('.slider .next')
.css({top:'425px'})
.stop()
.animate({top:'327px'},300,'easeOutCirc')
}
})
$('#contact-form').forms({
ownerEmail:'info#dohatutor.com'
})
});
</script>
I think this is the piece of code that links to a javascript file which in turn calls "mailhandler.php".
<form action="some script" METHOD="POST" ENCTYPE="multipart/form-data"></form>
action="php or asp or pl script for processing form"
You didn't specify where the form should post to - what is the name of the script that you want to post this form to?
Now it says:
form action="#"
And it should say something like:
form action="contact.php"