City/Country - Post/Zip code matching/validation checking on web pages - javascript

I'm currently looking for possible ways to implement a post code/zip code checking mechanism on my "contact us" web page where the user selects a country and/or city and the system lists or validates the associated post/zip codes against the available and valid post codes in that region preferably through JavaScript or jQuery.

This can be done in JavaScript or jQuery with AJAX and a few MySQL queries, there are several free zipcode databases you can use... I wouldn't suggest trying to implement this as a standalone JavaScript or jQuery script...

Another option could be to validate the posdtcode using an addressing API (such as Postcode Anywhere's, the company I work for: http://www.postcodeanywhere.co.uk/support/webservices/PostcodeAnywhereInternational/Interactive/RetrieveByPostalCode/v2.2/default.aspx) to check for the presence of a Postcode as well as validating it's format. THis can be done easily via JavaScript. It would also allow you to validate that the city matches.

Related

Turn Dynamics 365 address field into dropdown list

I’m new to both Dynamics 365 and javascript.
By now users when have to fill an address form write values manually, therefore for the same region we have values like: Lombardia, LOMABARDIA, lomb, Lombadia, etc...
I can't create custom fields because address fields are grouped into composite field and are used for outlook sync.
So i think the right way is create a javascript mask that paste the choosen value in the free text address field, but here is my biggest problem, how to set that mask...
Questions:
Is this the best practice? if not what is?
I am able to create javascript's list and get/set value from crm, but i dont know how to build it over a free text field, any help?
You should consider address resolution API, you will then be able to split the selected address that will be in a standard format. Try to check out Experian or even the google API, you can build a custom web resource, hook up the JS that will do address resolution for you, on selection split the values in the composite fields.
Rather than "build it over a free text field", which is unsupported, you can build your own custom HTML web resource and add that to the form.
As this document points out, you will need to use parent.Xrm.Page to reference the form - e.g.:
var customerRef = parent.Xrm.Page.getAttribute('customerid').getValue();
This forum indicates that although Xrm.Page is deprecated in v9, it is still valid (for now) to use parent.Xrm.Page from a custom web resource.
Also, please note that to enable accessing the form you should include
<script type="text/javascript" src="../ClientGlobalContext.js.aspx"></script>
in your custom web resource.

How do I populate form fields on a page from a database based on the page url?

Hello first I’d like to say, please excuse my ignorance to this all, as I’m very new to this all. I just started and still trying to understand this.
So far I have a database set up and I’m trying to retrieve values from a database to fill in a form on a page when it loads. The record or row/values that need to be retrieved from a database depend on the page’s URL.
I’m ok with html and css but still trying to learn more about jquery, JavaScript, sql, php and so on and so forth. I realize I have a ways to go and honestly some of the guides and tutorials online are kind of confusing because everyone has a different way of coding. So I’m a bit confused.
I’ve included a simple chart to breakdown what I’m trying to do.
If someone could point me in the right direction I’d be really grateful! Thanks.
If I understand you well, you want to setup a form and populate some fields of this form with a query forms a database, the primary key of the record being relative to the url.
The first step is to build the url, you can pass some parameters to an url by adding a ? at the end of the url followed by the parameter name, the = sign and the parameter value. If you have more than one parameter, you should separate each parameter with the sign &.
So your url could be something like this :
www.examplesite.com/page&.html?key=key_A1
Then, you'll have to choose if you want to build the page on the server side with a language like php, in which case you retrieve the parameter, query the database, build the html form and send it to the client.
You can also go client side with plain javascript or jquery, in which case you will still have to do some server side programming to query the database but will use an ajax call to get the data and will populate the fields in Javascript or JQuery.
You can do this using Javscript(using Ajax)
U need the key to search for get the results from database
Using ajax call get the data, You might have to write code to get the details from database using any server side prog language
Using javascript to fill the form input with the received data.
Google for jquery ajax examples, and how to populate input using javascript.
There are many frameworks out there that have DataBinding built-in that do the same job a lot easier. My favourite would be Angular Js, you can try Ember and lot more out there, choose the one you feel comfortable with.

Use Python to return data from a Webpage's Ajax call

I'm writing a program in Python that needs to use a site's advanced search options. Specifically, the search page is the NVC advanced search page . I know the names of the projects and versions I need to search for, so ideally the program would select the project names and versions numbers from the dropdown lists, then return the results page(s).
I'm totally unfamiliar with HTML and Javascript, and I'm fairly new to Python, so I don't know if there's a way to 'click' these dropdown menus via Python, then return the results. The fact that the Javascript makes an Ajax call further complicates the situation, since I can't just load the page's source and parse out the list of project names and version.
Can anyone with some Python/Javascript/Ajax experience send me in the right direction?
An example use of this program would be that I start out with the project "glibc' and its version number '2.3.6' The program would make sure that this combination is listed at all (which isn't guaranteed), then return the results page (which has about 13 results).
The Mechanize Python library is perfect for form automation. There is an example of how to edit and submit forms on the examples page.
If a human user is using that search page, they click on one of the product links, which then load the list of products from another page, e.g.:
http://web.nvd.nist.gov/view/vuln/cpe/cpe-chooser?index=0&component=Vendor
This page is unfortunately not using JSON, so they have some custom javascript parsing for the response. The data from this response is then displayed as a drop-down for the user. When the user selects a product, the browser selects the correct value, so that when the form is submitted, it will be part of the query. e.g.:
http://web.nvd.nist.gov/view/vuln/search-results?adv_search=true&cves=on&cpe_vendor=cpe%3A%2F%3Aa-a-s_application_access_server
In this, cpe_vendor=cpe%3A%2F%3Aa-a-s_application_access_server is the important part. The part before the = sign is the field name, the part after is the selected value (which originally came from the ajax request). The funny %3A bits are URL-encoding.
So you don't actually need to interact with the page, since you know the names of the vendors and products for which you want to search; you just need to look up the field name (cpe_vendor for vendors) and the value for the specific products/vendors (cpe:/:a-a-s_application_access_server for my example above), then do a request to the normal search URL.
The advanced search options page sends the options via GET to the results page, giving you the URL (linebreaks mine to make it clearer):
http://web.nvd.nist.gov/view/vuln/search-results?
adv_search=true&
cves=on&
cve_id=&
query=&
cwe_id=&
cpe_vendor=cpe%3A%2F%3Aian_bezanson&
cpe_product=cpe%3A%2Fa%3Aian_bezanson%3Adropbox&
cpe_version=cpe%3A%2Fa%3Aian_bezanson%3Adropbox%3A0.0.3_beta&
pub_date_start_month=0&
pub_date_start_year=2005&
pub_date_end_month=2&
pub_date_end_year=2009&
mod_date_start_month=2&
mod_date_start_year=2007&
mod_date_end_month=9&
mod_date_end_year=2009&
cvss_sev_base=&cvss_av=&
cvss_ac=&
cvss_au=&
cvss_c=&
cvss_i=&
cvss_a=
It would then take a bit of sleuthing to figure out what bit of the url is what information from the form but that should let you then just scrape the results page.

Best method to submit content with jQuery

Maybe you can help me understand some pretty basic stuff here. I am new to jQuery and web in general (though I have a lot of winforms / win32 experience). I have a website that runs on Google App Engine and uses Django and jQuery. The website is used to order a service. It has three forms:
A form in which you describe yourself (e.g you input name, address and so forth) you click next and then the following form appears:
A form in which you input the info of the service you want, such as service name and date. this form needs to display the data you entered in the previous form (form 1) in case you forgot something. you click next, and then the system needs to save all the data you wrote so far, and process your request for a service (this is done at the server side). this form is now displayed:
A form which shows a summary of your service request (and allows you to do other things such as sending the info to other people and so forth).
How would you transfer the data from form 1 to form 2 and then to the server? POST? is this safe? how will you do this in code? is there a way to transfer JS objects?
Make one form in one page and using JavaScript display sections of the form as needed. As far as submitting form values is concerned, you can either submit directly to script via form attribute action="...script url..." , or if you choose to employ AJAX you can use JavaScript or use jQuery's $.post().
This is a pretty open ended question.
So I'll start with one of the unnumbered questions first: "Is this safe".
The quick answer is probably no.
Here's some examples of how to answer that question:
Example:
I want to make a javascript app that
can collect data. I will hold all
data in this javascript object.
1: Is this safe. 2: No it's not, it
can be manipulated by anyone with a
browser.
Example 2:
I will just transmit that stuff via GET or POST to my
server and then mess with it there.
1: Is this safe. 2: No it's not, I
don't really get how stuff is stored
and my ignorance will cause my data to
get stolen.
Example 3:
I totally understand my server and my
initial page.
1: Is this safe. 2: No it's not,
unless all of my data is transmitted
over SSL/TSL it is widely available to
nefarious uses.
Example 4:
I have an SSL service and I understand
everything about my data transmission. I need to
store my information to retrieve it later.
1: Is this safe. 2: No it's not. I am using Google App engine so I'm just a trusting individual OR I'm using S3 and I trust them. or I'm using a sql server with whatever os and I trust those vendors, etc.
Example 5:
I feel ignorant that I just blindly
trust my vendor.
1: Is this safe? 2: No it's not.
(Obviously)
All that said you're using a Google App Engine backend so there's a ton of help on this.
Sorry it's my birthday and your question caused me to wax philosophically while I waste the day at work.
But remember, the prudent answer to "Is it safe" is always "No"

How to create the automatic mass form submitter script to be used on the 3rd part websites, where I know their fields names-values?

I need a script that can handle the following tasks.
Take user data from my database and fill in and submit / post data to forms
located on third part websites.:
So I want to know if is it hard to create or do somebody knows if does exists some script for mass form submissions in PHP -Javascript-Ajax ?
I run Dancers & Hostess & Model jobs website, I would like to find some script which allows the girls automaticly submit to hundreds websites forms (other 3rd part model agencies) with their similar model application form info on my website previously specified,
1).Firstly the girls will fill out my
agency portfolio very detailed form ,
like this i will get all the model personal info
from them ,
2) Secondly i would like to allow
for example models to submit to
100 and more other model agencies
forms (I will find those websites before, and I
will get their field names = values
and thanks to some script would like
to connect them with every girl data
already created in my website to
submit .
I would like to implement it to my wordpress website where the girls has their portfolios instead of my pages .
I would like to offer this service especially to models , it should work like some directory submitters , The script knows names - values and fill it out itself, but I want it online - browser side, where the girls should only fill out captcha if there is and click the button "submit".After succesful submit it should offer other form to submit.
I would be very happy if you know the answer or if you can redirect me to some article
example website :[SEMI AUTOMATED LINK DIRECTORY][1]
[1]: http://www.onewaytextlink.com/links.php?type=free&pagenum=1"SEMI AUTOMATED LINK DIRECTORY"
Sorry, but it ain't gonna work. Cross-domain ajax is forbidden. Although you can avoid this restriction more or less by various techniques, many sites won't accept cross-site requests due to security reasons.

Categories

Resources