Make Paypal accept variable as price - variables

I have recently started building a custom PC website with Serif Web X8.
I was trying to make a form that outputted its value to another page where it could be payed , after a while I managed to get some code (via hours of copy paste and edit) that was a form that sent its value to another page , however I do not know how to then get the variable that is the price and set it as the price for a paypal button.
I tried this:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="custom" value="<?=$finalpriceexcvat;?>">
<input type="image"
src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0"
name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif"
width="1" height="1">
</form>
But when it redirects to paypal its says "Some required information is missing or incomplete. Please correct your entries and try again."
I have gone through the code and checked it against some other html code that does the same thing, but to no avail.
Am I missing any code?
Here is the link to a sample form.

Related

Using cookie authentication and POST in an iFrame (iFrame content is ASP MVC Core, parent site 3rd party)

I have read through many answers on this topic but none seem to apply to what I am trying to do (or I am misunderstanding the problem entirely). Where a lot of my confusion lies is around whether it's the parent window or the iFrame that needs settings changed.
We have a small portal that allows users of our customers (asp mvc core 6 multi tenant app) to login and view their data. So far it works great, all but 1 of our customers do not iFrame the portal, we are trying to make it so they can frame our portal. They have their own domain.
Our authentication is the regular ASP Identity using cookies that is built in to the framework.
I've recreated a similar setup, I have a simple parent site that has this (the sub domain is their own sub domain to our site and if you go there you get the regular portal).
<div class="text-center">
<iframe src="https://sub.ourdomain.com" width="525" height="800" name="b3iframe"></iframe>
So far anything I do other than link to a new page fails within the iFrame. I can't POST a form, use AJAX, etc. Another problem is even if try to log them in (without POSTING a form, just hardcoded login for testing) the cookie does not set and the portal returns to the login page.
I have tried setting 'same-site=none' on both the parent and the framed site. (like what this describes).
I have tested simple things like making a fetch request and that fails (I get a 302)
All POST calls fail (even ones that don't require authentication, just test pages fail with a 400). When I get the 400 response code it is displayed within the frame.
I am aware and have used the ability to pass messages between the parent and iFrame but I don't think that can solve the cookie/POST problem.
I have tried using the 'target' attribute on the form to point to the iFrame but it appears that is for situations where the form is not inside the frame
The iFrame code can be just a simple login form:
<form method="post" id="loginForm">
<div class="form-group">
<label>Email Address</label>
<div>
<input asp-for="UserName" class="form-control" />
</div>
</div>
<div class="form-group">
<label>Password</label>
<div>
<input asp-for="Password" type="password" class="form-control" />
</div>
</div>
<div class="mt-5">
<button type="submit" style="width:100%" class="btn btn-primary tenant-custom-button">Log in</button>
</div></form>
What's frustrating is even in a mock parent website that I made and have full control of I can't seem to set it up so that the iFrame can use cookies or POST/GET (the test parent website is also ASP MVC CORE). The only thing I can do is have links to other pages without auth or POSTS.
Thanks for your time,
Brian

Add to Cart button not working in one div but works well everywhere else - Shopify Liquid

I'm trying to have a potw section on my home page. It only showcases 1 product from a collection and there's an Add to Cart button next to it that should add it to the cart but it isn't doing anything currently and I can't figure out why. I am using Timber and I have the exact same syntax on as I do on the product.liquid template.
You need to tell it the id of the product/ variant you are trying to add.
Try adding this somewhere within the <form> element:
<input type="hidden" name="id" value="{{ product.variants.first.id }}">

Adding google custom search to a a ready-made designed search box

I have my own design of a search box in my website and was keen on keeping it rather than displaying Google's design.
<div class="search-header">
<form action="#">
<input type="search" value="" placeholder="Search.." autocomplete="off" required="required" name="s" />
<input type="submit" value="search" />
</form>
</div>
The following code is the one I have on my site. It came already with the template I bought. How do I keep the same design and add Google custom search to it?
We'll want to start by looking here for more information.
https://developers.google.com/custom-search/docs/tutorial/introduction
This will tell you how to get started with google's custom search.

Unobtrusive credit card validation not working once deployed

I'm running MVC4 and .NET 4.5. I applied the data annotations credit card validator to my model. I'm having issues with the client side validation. It works fine on my development box, but once deployed to production, it doesn't work.
When viewing source on my dev box, I get this:
<input data-bind="value: creditCardNumber" data-val="true" data-val-creditcard="Credit Card Number is invalid." data-val-length="Credit Card Number must be less than 20 characters." data-val-length-max="20" data-val-required="Credit Card Number is required." id="CreditCardNumber" name="CreditCardNumber" value="" type="text">
On my production box, I get this:
<input data-bind="value: creditCardNumber" data-val="true" data-val-length="Credit Card Number must be less than 20 characters." data-val-length-max="20" data-val-required="Credit Card Number is required." id="CreditCardNumber" name="CreditCardNumber" value="" type="text">
The difference between the two is that the production system is missing:
data-val-creditcard="Credit Card Number is invalid."
Any ideas? The server side validation works, but not the client side.
Thanks,
Vincent

IE10 issue with form tag

I have div in html
<div id="test"></div>
If I do
$('#test').html(' <form method="GET" action="whatever"> <input type="text"/> </form>')
In IE 10 I will get
<div id="test">
<input type="text">
</div>
In Firefox or IE 8 I will get
<div id="test">
<form action="whatever" method="GET">
<input type="text">
</form>
Can you help me with IE10?
(jquery 1.7.2)
Around div test there is another form tag.
You stated in the end of your question that you are attempting to nest one form inside of another. Please have a look at the specification regarding the content model for form elements:
4.10.3 The form element
Content model:
Flow content, but with no form element descendants.
It is invalid to nest form elements. This may be why Internet Explorer 10 is trying to protect you from invalid markup that may not work properly in all browsers. The latest version of Google Chrome appears to also remove invalid child forms.
If you need to submit one form from inside another, use the form attribute on buttons instead. This will tell them which form they are to submit, and not necessarily the form they are currently in.
4.10.18.3 Association of controls and formsA form-associated element is, by default, associated with its nearest ancestor form element (as described below), but may have a form attribute specified to override this.
Note: This feature allows authors to work around the lack of support for nested form elements.
So you could have the following:
<form id="one">
<!-- This button submits #two -->
<input type="submit" form="two">
</form>
<form id="two">
<!-- This button submits #one -->
<input type="submit" form="one">
</form>
Try using .html() to append the the form with HTML functionality and after that use .append() to push every element in the form, so you have something like:
$('#test').html('<form method="GET" action="whatever"></form>');
$('form [action="whatever"]').append('<input type="text"/>'); // Note for selector will be better to use ID for the form