Access to form data that submitted by an unknown source - angularjs

Scenario:
Another web application get a link from my web app and then POST some data to the link, like this:
<form action="http://www.example.com/mylink">
<input type="hidden" name="data1" value="1" />
<input type="hidden" name="data2" value="2" />
<input type='submit' value="submit" />
</form>
I know there are two parameters data1 and data2 in POST data and nothing else.
Question:
How can I access to this data in Controller?
Because this form submitted in another web application so there is not ng-model directive and or ng-click="submit(customerForm)". I don't know even what is form's name.

Related

Cannot get HTML5 validation to work

I cannot get html5 validation to work when using it with AngularJS.
I simply need a field to be required, but instead of showing me the error, it submits the form.
I would appreciate anyone's input on how to get the html5 validation to work with AngularJS.
I have the following set up in my web.config file:
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
I have the following set up in my masterpage:
<form id="userForm" name="userForm">
I have the following input box set up with the required attribute:
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Enter Check Slip Number" id="txtCDDepositSlipNumber" name="txtCDDepositSlipNumber" ng-model="formCtrl.depositSlip.selectedSlipID" required />
</div>
How do you submit form? You listen ng-submit (and have in the form of input type=submit) or handled ng-click on the button/item?
If the handle ng-submit the form - html5 validation works.
write submit button like:
<input type="submit" Value="Submit" ng-click="submitForm(model)">
ng-click will trigger the function you have written on angular controller.
by giving type="submit" to input tag validation would properly work on click of submit button.

paypal order summary empty on mobile

I couldn't find any similar questions (most dealt with broken form posts) but this is not the case.
I have a paypal form that works flawlessly on desktop/laptop. On mobile devices I successfully get to paypal but there is nothing in the order summary, as if nothing got posted to paypal. A variable dump shows all form variables are in place, so I'm quite confused.
Here is the form I submit:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="myRegister">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="service#obscured.com">
<input type="hidden" name="item_name" value="Some description.">
<input type="hidden" name="amount" value="5.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="item_number" value="1248" />
<input type="hidden" name="cbt" value="Click This Button To Register." />
<input type="hidden" name="return" value="http://mydomain/redirect.cfm" />
</form>
And that works on Desktop. I am just trying to get it work within a phone browser at the moment. I'll deal with the Paypal phone app at another time, if needed.
Any help appreciated.
Edit: This is also happening with PayPal hosted Buy It Now buttons as well.
Your code works fine for me on mobile, I can see the order details by tapping the "My total". The details are hidden at the first place though, I have to tap to make it show, seems it's designed this way
Within Android browser settings, clear setting for individual websites: Settings > Content Settings > Website Settings. Select paypal.com. Apparently there was a issue that was not resolved just by clearing the browser cache.

Angularjs Open Window With Post Params

I have a two forms in my application.
In the first one the user sets his data. When submitted the form data gets checked and an entry is made into a database with $http.
The second one is hidden and contains the payment parameters for either paypal or amazon payments.
I need one of two solutions (I can do A but my gut feeling is that B is better):
A)
Trigger the submit function of form B when the promise of form A's http is resolved.
This would be one solution which is not very good I guess:
HTML
<form method="POST" action="{{spendenController.paypal.actionUrl}}" target="_top" id="paypalForm">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="{{spendenController.paypal.accountEmail}}">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="DE">
<input type="hidden" name="amount" value="{{spendenController.spenden.amount}}">
<input type="hidden" name="item_name" value="Spende">
<input type="hidden" name="notify_url" value="{{spendenController.paypal.notifyUrl}}">
<input type="hidden" name="return" value="{{spendenController.paypal.successRedirectUrl}}" />
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" border="0" name="btnSubmit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>
Controller
document.getElementById('paypalForm').submit()
B)
Or load a page with POST params directly from the controller/a service when the promise is resolved. In that case I wouldn't even need the second form.
Question: How to open a page with POST from the controller?
I do not just want to send POST data with $http.post I need the user to see the paypal checkout window in order to fulfill the payment.

Angular JS Forms submit not sending model data

In the following example, message is undefined when I display it in the controller after the event is fired. Why?
<form>
<input type="text" ng-model="message.Title" />
<textarea ng-model="message.Content"></textarea>
<input type="submit" value="Send Message" ng-click="sendMessage(message)" />
</form>
Controller:
$scope.sendMessage = function(message) {
console.log(message);
}
My code seems identical to the documentation here except my controller manages the entire "page" not just the form.
Wow nevermind, apparently when you submit with blank values it doesn't even create the object.
I see you've found your problem, but I'd like to propose a solution to prevent your problem anyway:
<form name="messageForm" ng-submit="sendMessage(message)">
<input type="text" ng-model="message.Title" required/>
<span ng-show="messageForm.title.$error.required && messageForm.title.$dirty">required</span><br/>
<textarea ng-model="message.Content"></textarea>
<input type="submit" value="Send Message" ng-disabled="messageForm.$invalid" />
</form>
The above will make the Title required, display an error message, and disable your submit button if the form isn't valid.

roundcubelogin with window.open function

I have already done autologin to roundcube via the following script
<form name="webmail" action="http://localhost/roundcube_mail/" method="post">
<div class="info" style="color:#f00;display:none"></div>
<input name="_action" id="_action"value="login" type="hidden" />
<input name="_timezone" id="_timezone" value="_default_" type="hidden" />
<input name="ajax" id="ajax" value="1" type="hidden" />
User <input name="_user" id="_user" type="text" value="anupam#excoflare.com"/><br>
Pass <input name="_pass" id="_pass"type="password" value="anupam123"/><br>
<input type="submit" >
</form>
it will work correctly.But i want to auto login roundcubemail via java script with window.open method for my p
The problem is that you want do do a POST request instead of a GET request. This might help you:
JavaScript post request like a form submit

Resources