I am using mixpanel JS for metrics, and I have to capture an event for the form when user tries to submit a form and there is check box which allows user to signup for newsletter . I want to track users who signup and check the box, and no idea as how to approach this problem. Thats how my form looks like
<form id="form_send_email" novalidate="novalidate">
<input type="text" name="first_name" id="first_name" placeholder="First Name"/>
<input type="text" name="last_name" id="last_name" placeholder="Last Name"/>
<input type="text" name="email" id="email" placeholder="Email"/>
<br/>
<input type="checkbox" name="learn_more" id="learn_more" class="css-checkbox" checked="checked"/>
<label for="learn_more" id="learn_more_label" class="css-label">Learn more about our products and sign up</label>
</form>
Usually one want to do some client side validation of forms before actually sending them to the server. There are loads of JS libs that can help you out, jQuery for example.
Then if all data looks ok, send the track request to mixpanel and submit the form.
Mixpanel have client libs for quite some languages, you might want to send the the track request from your server?
Related
This question already has an answer here:
How to change the textbox value from checkbox
(1 answer)
Closed 6 years ago.
I have built an order form in which the user would enter in a company name, last name, email and an address and an optional checkbox for shipping priced at $19.99. I downloaded the paypal payment form module for my dreamweaver cs5 program which converts the form into a paypal form.
The nice thing about this program is that it automatically creates a mysql database with all the input fields when a person clicks the "pay now" button It also generates the files automatically in a folder called "PPPaymentForm" which i then upload in the root of my site and gives me a backend as well so i can monitor all the payment transactions.
So back to my original issue, i need some way so that if a person decides to click the checkbox which is set at $19.99, that it will automatically add to the price which is set in an hidden input named "hdwppamount" where the value is set to $175.00. So therefor if the shipping option is clicked, the person would click the "Pay Now" button and would be redirected to the paypal payment page, with the new calculated price at $194.99.
I am not proficient with javascript or php, and tried many functions myself but nothing worked. Could someone help me with this please?
Thank You
<form action="PPPaymentForm/PPPaymentForm.php" method="post" name="topchoiceform" id="topchoiceform">
<input placeholder="Company Name" type="text" name="companyname" required>
<input placeholder="First Name" type="text" name="firstname" required>
<input placeholder="Last Name" type="text" name="lastname" required>
<input placeholder="Email" type="email" name="email" required>
<input placeholder="Address" type="text" name="address" required>
<input type="checkbox" id="shipping" name='shipping' />$optional Shipping($19.99)
<button name="submit" type="submit">Pay Now</button>
<input type="hidden" name="hdwtablename" id="hdwtablename" value="1">
<input type="hidden" name="hdwppproductname" id="hdwppproductname" value="Basic 175 Plan">
<input type="hidden" name="hdwppamount" id="hdwppamount" value="175">
<input type="hidden" name="hdwppcurrency" id="hdwppcurrency" value="USD">
<input type="hidden" name="hdwpplanguage" id="hdwpplanguage" value="en_US">
<input type="hidden" name="hdwok" id="hdwok" value="">
<input type="hidden" name="hdwemail" id="hdwemail" value="email+gmail.com">
<input type="hidden" name="hdwnook" id="hdwnook" value="http://">
<input type="hidden" name="hdwactivation_email" id="hdwactivation_email" value="email">
</form>
First, we detect when the shipping checkbox is changed, then we check to see if it is in a checked state. If it is in a checked state, we add the shipping cost to the hidden text box. We also need to reset the value if the user changes their mind about shipping so you need a basic IF ELSE condition on it.
Try this:
$('#shipping').change(function(){
var hdwppamount = Number($("#hdwppamount").val())
var shippingcost = 19.99;
if (this.checked) {
$("#hdwppamount").val(hdwppamount+shippingcost)
} else {
$("#hdwppamount").val(hdwppamount-shippingcost)
}
})
JSFiddle: https://jsfiddle.net/rdawkins/8qrm3mf1/14/
I have a Bootstrap form which contains Various fields which need to be entered by User.On Submission of this form I want it to send data to WebService.
But it is not sending user input data of the form.Here is the HTML Markup.
<form class="form-horizontal" role="form" action="~/RegisterUser" method="post">
<div class="form-group">
<label for="firstName" class="col-sm-3 control-label"> First Name </label>
<div class="col-sm-9">
<input type="text" class="form-control" id="FirstName" placeholder="FirstName" required />
</div>
</div>
</form>
and When I am seeing in chrome I am getting Request URL:http://localhost:54990/RegisterUser as Request URL.
Is there anything I am missing on the form or input field creation.
My Service is correct and I am able to get the debugger breakpoint over there with no data that was posted from User.
Your input doesn't have a name. Only named inputs can be successful.
You always give all fields that should be accessed after posting a form a name-attribute. So do something like
<input type="text" class="form-control" id="FirstName" name="FirstName" placeholder="FirstName" required />`
then you can access it by using
$_POST['FirstName'] or however you want to access the values posted.
I have Internet service. They provide Login page for internet Login (Ex: i.e. http://globalNetSolutions.com/Login.html). If i am buying one website (Ex : i.e. http://MyNetSolutions.com/Login.html) is it possible to From my website username & password to http://globalNetSolutions.com/Login.html website (because of that 3rd party site not looking grate.i want login from my own website.)
I changes are needed where do i change my code :
<form action="" method="post" onSubmit="">
<h2>LOGIN TO <span class="red"><strong>MyNetSolutions</strong></span></h2>
<label for="username">Username</label>
<input type="text" id="username" name="username" placeholder="choose a username...">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="choose a password...">
<button type="submit">LOGIN</button>
</form>
You can use oauth for lo-gin purpose. But problem with that is you can not use user password for encryption. Id you do not care about that, then you can go ahead with oauth approach.
I have a form in an app I'm building that allows a user to submit their name and email. This form is duplicated on two tabs (on the same page). Here's the basic form:
<form class="user-submit-form" ng-submit="userSubmit(user)" ng-hide="userSubmitted">
<h4><strong>FOR THE CHANCE TO HAVE YOUR STORY DRAWN, TELL US YOUR NAME AND CONTACT METHOD.</strong></h4>
<span>Entries limited to one caption per cartoon per person.</span>
<br>
<input type="text" title="Name required" ng-model="user.name" size="32" placeholder="Name" required>
<input type="email" title="Email required" ng-model="user.email" size="32" placeholder="E-mail Address" required>
<br>
<input type="checkbox" title="Must agree to Terms & Conditions" class="terms"
required><span>I have read and accept the Terms & Conditions</span>
<br>
<input class="user-submit-stories user-submit" type="image" src="images/submit_name.png">
</form>
When I make changes to the user.name attribute the both of the forms update the value. However, when I update the user.email attribute the other form's value is not updated. I've also noticed that when I try to explicitly define the model's attributes in the related controller, the change is not made in the form for user.email
What could be causing a situation where one attribute is properly binded but the other is not?
I have a website that I want to create a script for. I just want to be able to, whenever opening the script, the username and password fields are filled in, and it automatically logins for you. This is what the code looks like for the username and password on the website:
<input onkeydown="javascript:submitForm(event);" name="username" type="text" size="20">
<input onkeydown="javascript:submitForm(event);" name="password" type="password" size="18">
This is the form action by the way, I don't know if it's needed:
<form action="https://secure.usli.com/CustomerLogin/login.ashx" method="post" name="form2" id="form2">
I would use a service such as lastpass for this.
They have an autologin feature which seems to do exactly what you want.
https://forums.lastpass.com/viewtopic.php?f=6&t=2949#p11389