Adding new fields to Magento 1.7 registration form - forms

Would anyone give me a step by step guide on how to add custom fields to Magento registration form which works on Magento 1.7. I have come across plenty & all of them were either supported for older version or too complicated for my understanding as I am pretty much new to it.

You need to add Customer Attribute
so you can do this with custom module you build or there is some modules out there that gives you this functionality like customer-attributes
It could be on the backend only or the frontend as well etc.. it has alot of features
This feature already in Enterprise edition but for community edition you need to implement it, or use custom modules

You can obtain what you need without spending any euro... using this extension and then putting in your regiter.phtml and edit.phtml something like this:
<li class="control">
<div class="input-box">
<input type="text" name="attribute-name" title="<?php echo $this->__('your pretty label') ?>" id="attribute-name" value="<?= $this->getCustomer()->getAttributeName()); ?>" class="input" />
</div>
<label for="attribute-name"><?php echo $this->__("your pretty label") ?></label>
</li>

Related

Unable to receive form submissions on Netlify deploys

I am using a simple form that was taken from one of the Netlify related docs:
<form name="contact" action="/" method="post" data-netlify="true">
<div className="field">
<label htmlFor="name">Name</label>
<input type="text" name="name" id="name" value="dave"/>
</div>
<div className="field">
<label htmlFor="email">Email</label>
<input type="text" name="email" id="email" value="email#email.com" />
</div>
<div className="field">
<label htmlFor="message">Message</label>
<textarea name="message" id="message" rows="6"></textarea>
</div>
<input type="submit" value="Send Message" className="" />
</form>
In using gatsby develop and working with/submitting the form, things seem to work fine. I get no errors and get redirected to the home page as expected.
After deploying the site with Netlify and trying to submit the form, I get the following page error:
In my Netlify backend, the form appears in the console but I cannot/do not receive submissions.
I am using a barebones gatsby-config.js, only incorporating gatsby-source-wordpress and gatsby-plugin-google-analytics.
I also tried adding /no-cache=1 to form action.
Can anybody advise?
It might also be worth noting that I have coded my form as a component and am importing it into my footer as such. In that way, it may be imported multiple times on different pages as mentioned in point 3 of this StackOverflow answer.
Thanks.
I learned that because I'm using Gatsbyjs, and Gatsby + Netlify = javascript forms, I needed to add another input type="hidden" to my form:
<form name="my-form" ... >
<input type="hidden" name="form-name" value="my-form" />
The documentation for this wasn't immediately clear but below are some links that address this:
Here's a link to an article that pointed me to the answer: How to
Integrate Netlify’s Form Handling in a React App
Here's another one if you're building in Vue: How to Integrate
Netlify Forms in a Vue App
And all about Netlify Forms
If you are using any redirect method then you have to add _redirects file in your root folder and add paths to it so that redirect can work.
It's may be confusing but you can visit this link for more help.

How Do Laravel Spark Forms Submit?

Laravel Spark has a number of forms in its settings area. Here's one that adds teams.
If I look at the source code of this form, I see the following.
The HTML source for this form looks like the following
<form role="form" class="form-horizontal">
<div class="form-group">
<label class="col-md-4 control-label">
Team Name
</label>
<div class="col-md-6">
<input type="text" id="create-team-name" name="name" class="form-control">
<!---->
<span class="help-block" style="display: none;">
</span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-4 col-md-6">
<button type="submit" class="btn btn-primary">
Create
</button>
</div>
</div>
</form>
Specifically, the form itself has no action or type parameter
<form role="form" class="form-horizontal">
My assumption is there's some javascript running that handles all this (a Vue JS component), but it's not clear
Where the Team Creation javascript source lives, and/or where Spark creates the component
How I can backtrack how a particular form to its javascript
Experienced programmer here -- just new to Spark and hoping this is simple/obvious for an experienced Spark developer.
Each <form> in Spark is typically handled by a Vue.js component containing its definition, and although they don't have action or method attributes, they do have special Vue directives, such as #submit (or #click if it's a <button type="submit">). The reason you don't see them in HTML in dev tools, is because those directives are compiled before rendering.
So the form you're referring to is wrapped into a <spark-create-team> tag. You can find the code that initializes this component in /resources/assets/js/spark-components/settings/teams/create-team.js; you'll also note that it simply requires the component definition from Spark's /vendor directory. In other words, component and form definitions are stored in Spark vendor files at /vendor/laravel/spark/resources/assets/js/settings/teams/create-form.js. Can you see that settings/teams/create-form.js part is identical? This should help you locate the underlying JS code for any component or form -- just search Spark's JS assets, and eventually its folder structure will become a second nature to you.
As for the SparkForm class, it's a helper class designed for working with form errors. Its definition is in vendor/laravel/spark/resources/assets/js/forms/form.js file, although I don't think you'll ever need to make any modifications to it; just follow Taylor's examples with forms using Axios, and you shouldn't have any problems with submissions or validation. Although for the later point, validation, I'd suggest using an external package, instead of defaulting to server-side validation, but that's a bit off topic here.
Hope this helps.

Not able to post magento reviews, request looks right

We are using magento 1.8.1 and hosting it both locally in an iis/mysql environment and also testing in an ubuntu lamp environment, so we can verify it is not an iis issue. It happens on both environments.
I got up to the point of integrating the product listing page, where we want to show product reviews and the product review fonts, so users can give their reviews without clicking on a link to go to a different page to add it. I managed to load the product reviews blocks. At first the form element of the add to product button was mixing up with the product review form, which i solved by closing the previous form before starting the review form. I can see in Fiddler the request going through and the action on the form element looks like this
http://localhost/index.php/review/product/post/id/2/
While this will actually make the browser send the request (as seen on fiddler, with the right amount of parameters), the review is never stored in the database, so i cannot see it in the pending reviews part of the admin section. After examining both my store's html source and the online demo, i could see there was a hidden form field on the official demo storing the form_key , which i added since, but it still will not work.
Any hints where to look at?
the whole reviews form block looks like this:
<form action="http://localhost/index.php/review/product/post/id/2/" method="post" id="review-form">
<fieldset class="">
<h3>You're reviewing: <span>Powermonkey extreme 2</span></h3>
<ul class="form-list">
<li>
<label for="nickname_field" class="required"><em>*</em>Nickname</label>
<div class="input-box">
<input type="text" name="nickname" id="nickname_field" class="input-text required-entry" value="">
</div>
</li>
<li>
<label for="summary_field" class="required"><em>*</em>Summary of Your Review</label>
<div class="input-box">
<input type="text" name="title" id="summary_field" class="input-text required-entry" value="">
</div>
</li>
<li>
<label for="review_field" class="required"><em>*</em>Review</label>
<div class="input-box">
<textarea name="detail" id="review_field" cols="5" rows="3" class="required-entry"></textarea>
</div>
</li>
</ul>
</fieldset>
<div class="buttons-set">
<button type="submit" title="Submit Review" class="button"><span><span>Submit Review</span></span></button>
</div>
</form>
We have the same problem, and I solved it.
Magento has a form key when submitting any information to the database. To generate the form key, add this code:
<?php echo $this->getBlockHtml('formkey') ?>

CFFORM data not readable in IE9

I have form, which I use for users to login to the site. It works in Chrome, but for some reason not in IE 9.
Here is the form:
<cfform name="loginform" action="login.cfm" method="post">
<div class="span12">
<div class="span2">
User Name:
</div>
<div class="span2">
<cfinput type="text" name="username" required="yes">
</div>
</div>
<div class="span12">
<div class="span2">
Password:
</div>
<div class="span2">
<cfinput type="password" name="password" required="yes">
</div>
</div>
<div class="span12">
<div class="span2">
<cfinput name="submit" class="btn btn-primary" value="login" type="submit">
</div>
</div>
</cfform>
I am normally accessing the variable as #form.username#, but it is empty if being used in IE.
The simplified use here:
<cfif isdefined("FORM.submit")>
username: #form.username#
</cfif>
I can't see anything wrong with your code above when I run it I have the username field available to me in the form scope correctly. What version of Internet Explorer are you using?
To better debug this I would suggest the following:
Look at the source of the first page and see if there is anything
strange there.
Install Fiddler2 (http://www.fiddler2.com/) then use this to see
exactly what is being posted to login.cfm.
Other things to look at:
Are you using a javascript or CF framework that might be interfering with things?
I don't see anything overtly wrong with your code either. Did you try this in Firefox as well? Sometimes you can get better debugging information there. Possibly an actual error message with it. Both IE and Chrome can do a bit too "good" of a job of obscuring errors on the page.
My suggestion would also be to use plain form tags. Don't use cfform tags. There's not much need for them here. They aren't really helping you much. You could do your own validation on those fields and know exactly what it is that you are validating. You could also test your field that way. Simply change that cfinput to an input and see if that field becomes available in your post. That would pretty quickly let you know that there's an issue with your implementation of the CFFORM tags.
And it's getting a little OT, don't forget to trim the input and wrap it in XMLFormat() and add cfqueryparams to your SQL lookups to minimize scripting and injection attacks. You can also use CF's scriptProtect or rewriting URLs in IIS to help. Allowing free-form entry to FORMs or URLs without any validation is VERY dangerous.

Clicking submit clears file field instead of submitting the form (IE9)

I got a weird error I hope you guys can help with.
Sometimes when the user tries to submit a form the file upload field image just clears and nothing happens. I doesn't seems like the form get submitted at all.
Then the day after everything works fine. The error occurs on random days/times.
First I thought it was a problem with the users computer but this happens on two different computers the customer has. One of the computers has Windows 7 professional & Internet Explorer 9. I don't have the setup on the other one.
I have tried with Google Chrome, Firefox 6.0.2, Internet Explorer 9, 8 (browser compatibility mode), 7 (browser compatibility mode) on windows 7 home with no problems at all on my computer.
Here is the form:
<form action="/user/image" method="post" accept-charset="utf-8" class="form_default" enctype="multipart/form-data">
<fieldset>
<ol>
<li>
<button type="submit" name="save" value="submit" class="button">Save</button>
</li>
<li>
<label for="image">Profile image</label><input type="file" id="image" name="image" />
</li>
<li>
<button type="submit" name="save" value="submit" class="button">Save</button>
</li>
</ol>
</fieldset>
</form>
There should be only 1 submit button per form.
So keep 1 save button as type="submit" ,change another to type="button"
Try using input instead of button, good luck!
ex
<input type="submit" name="mysubmit" value="Click!" />
you should use:
<input type="button" onclick="customFunction" />
write what you want to do in customFunction(javascript)
There is no clever workarounds for this, IE9 does not allow a file to be tampered with via JavaScript probably for security reasons.
First of all, pls let us see your php coding to send this form....
Usually form submission errors such as this have server-side coding errors..
Maybe you should check out your PHP coding and see what happens in your
$_POST['save']
area....
Hope this helps... :)