Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Default Country by IP Address
Last Post 07-02-2012 06:17 AM by Paul. 14 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
PaulUser is Offline
going with the flow
going with the flow
Posts:31
Avatar

--
06-04-2012 10:36 AM

    I'm trying to set up a registration form that will be used in many countries. How can I default the country field by looking at their IP address?

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    06-06-2012 04:10 PM
    Hi Paul - Are you using the DNN Country field type or a combo box that is maybe pre filled with all of the countries from a SQL query maybe?

    You would possible be able to use the "SQL Default" and default this data to an IP Address. Then, use a client side event to set the value of a combo box after this.

    Thanks,

    Chad
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    06-08-2012 12:26 PM
    I'm using the DNN Country field type. I'm not sure I follow your possible solution. Can you please elaborate? I'm very new to using DR.
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    06-08-2012 01:30 PM
    Hi. Well, basically to handle the option with a client side event you would need to use a "ComboBox" and a SQL Query which is listed there as a default SQL query to be able to pull in all countries.

    -Chad
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    06-11-2012 05:08 AM
    That solution sounds like I would need to recreate the default logic for the DNN country field. And it sounds like a lot of work. It's possible, but I would like to go that route as a last resort. If possible, I'd like to leave it as is (using the DNN country code) and just set the default country code value. I was able to create a table that contains all the IP ranges with the country code it's assigned to. All I need to do is check if the country code is empty when the page is loaded. If so, query that DB and take the return value as the default country code. Is that possible? If so, I could create a stored procedure, pass in the user's IP, and it would return a default country. Is this possible?
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    06-13-2012 06:51 AM
    I'm still trying to figure this out. I think I am close. First, I created a table with all the IP ranges and their associated country codes. I then created a SP that will return the Country Name when I pass in the users' IP address. I'm also using this same logic on a dynamic form using the Initial SQL DataBind feature. This works exactly how I want it to work. If I am not logged in, it defaults to the correct country and if I am already logged in, it defaults to my previous entry (it's a contact us form that defaults my profile info).

    However, I'm not having as much luck in my DR form. First, I do not see an Initial SQL DataBind. Second, I tried calling the same stored procedure from the "default value" setting, but no luck. Third, I was looking at the "Question Events", but I wanted the page to default to the value, and not trigger when the user goes to that field. How can I achieve the same effect as I get when doing this in Dynamic Forms?
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    06-14-2012 02:41 PM
    Hi - Well, I think you are close but there are a few hiccups... The most specific hiccups is that I believe only hidden fields and text box fields allow for the "SQL Defaults" and Dynamic Registration is tied to all user profile fields themselves so there is no SQL data bind option / feature like Dynamic Forms has.


    So... The first question would be... Do you have the data showing up properly from a hidden field or a text box field? After that you would probably need to interesting JavaScript / Client Side Event to actually get the data to be set properly within the Country field type.


    Thanks!

    -Chad
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    06-15-2012 11:40 AM
    Ok, I think we are even closer. I created a hidden textbox and set the default to call my SP and return the default value by passing in my IPaddress. So, now all I have to do is check my current country field and see if it's set. If not, then set it to my hidden field value. How would I do that? I'm not the greatest at JS. How would you recomment I code that?
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    06-18-2012 08:05 AM
    Hi Paul - Well, I am not actually sure on the exact JavaScript for this either. You would need to use a tool such as FireBug and the "Inspect" element to find the exact ID of the field. Then you would need to change the value from that ID.

    You might find this tutorial useful:
    http://www.javascript-coder.com/jav...alue.phtml

    If you need us to be more directly involved we do offer these implementation/writing JavaScript and client side events via Premium Integration Services. You can find out more details and/or purchase hours at http://www.datasprings.com/hours .

    Thanks,

    Chad
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    06-19-2012 10:49 AM
    So, I was able to write some Javascript code to check the value of my temp field that contains the country by looking up the IP address. The javascript code checks the value if the country field and sets it if it's not already set. When I'm logged in and go to update/view my profile, it does not set it, but when I try and register when I'm not logged in it sets it. So, this is all good and everything works as I had hoped.

    However, I have 1 small problem. When I make the field hidden, it stops working. Any idea why that would be? (so so close).
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    06-19-2012 01:31 PM
    Hi Paul,

    Hmmmm... That is interesting. How are you hiding the field. Is the question type just changing from textbox to hidden or how exactly are you hiding the field?

    Thanks,

    Chad
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    06-20-2012 03:42 AM
    Yes, all I am doing is changing the field type from textbox to hidden.
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    06-20-2012 02:02 PM
    Hmm... Well it shouldn't be doing this. Are you using a client side event and if so are you hard coding the element ID? The field names work a little differently but the ID's between textbox fields and hidden fields.

    If not... and this is the only change you are making... then please create a support ticket at http://support.datasprings.com and I should be able to find a resolution pretty quickly.

    Thanks,

    Chad
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    06-21-2012 11:44 AM
    Actuall, I didn't realize that the element name would change when I made it hidden. I got the new name and updated my JS and it's all working perfectly now.

    Thanks for all your help Chad!
    PaulUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    07-02-2012 06:17 AM
    I just realized I have a small bug in this logic, but I think it's a common issue and I just need to update. When I default to the US, my "state" field does not populate like it would if I changed it from the dropdown. I will have this problem if in Canada as well. Quesiton 1: How do I get it to update the "states" field? Question 2: If I wanted to hide that field if not in the US or Canada, how would I do that?
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
     
     
       
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi