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!

SQL default value not working with short field
Last Post 05-20-2010 07:22 AM by Chad Nash. 7 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
billgUser is Offline
going with the flow
going with the flow
Posts:31
Avatar

--
05-18-2010 09:48 AM

    Hi, I've seen a few posts regarding issues similar to this but I could not find a definitive solution. I have created a question event which when fired sets the default value (sql driven) of a text field. When I use the following sql statement (a literal value), it works perfect: See example below:

    SELECT UserID AS DefaultValue
    FROM Users WHERE Email = 'name@company.com''

    However, when I replace the literal with the short name and fill in the (short name) text field before firing the question event, it does not work. I have tried both including the ' ' around the short name and not including the ' ' around the short name.

    SELECT UserID AS DefaultValue
    FROM Users WHERE Email = '$(txtEmail)' - does not work.

    SELECT UserID AS DefaultValue
    FROM Users WHERE Email = $(txtEmail) - does not work.

    What am I missing? It seems like it should be working but it isn't. Thanks.

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    05-18-2010 04:43 PM
    Bill,

    Hi. A few things...
    1. Can you tell me if the sort order of txtEmail is before or after the fields affected by the question event?
    2. Can you tell me if you make txtEmail a hidden field with a static value if that works?

    #3. Do you see anything when you enable debug mode on the form?

    It could be something related to how we don't always allow textbox fields to be used in SQL Events because of the risks of SQL Injection. I can tell you some ways around it if this is the case but for now please let me know the answers to #1 and #2 above. I do know in any scenario you would need to use the ' marks.

    Thanks,

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

    --
    05-19-2010 05:55 AM

    Chad,

    1. Can you tell me if the sort order of txtEmail is before or after the fields affected by the question event?

    --- Answer: --- txtEmail is before the field affected by the question event.
    2. Can you tell me if you make txtEmail a hidden field with a static value if that works?

    --- Answer: --- Yes. txtEmail as a hidden field with a static value works.
     

    This is really what I was trying to do---I have two DNN Suggest fields (SugName and SugEmail). I wanted the user to enter a (valid) value in each DNN Suggest field and have an SQL question event validate that both values (SugName and SugEmail) are correct for the same user record and if so, enter the UserID (for the SugName and SugEmail user)  in a hidden field.

    I tried setting up a question event for one of the DNN suggest fields but event though I have the option to select the Suggest field in the question event set up, when I selected a value from the SugEmail field, I did not get a question event postback. 

    So, I thought I would test using a text field and use client side javascript to populate the text field from the Suggest field - $(txtField) = $(SugField). However, when I put the client side javascript in the suggest field (it comes before the text field) and entered a value in the suggest field, the client side java script did not populate the text field. Go figure. 

    I don't really want to use a dropdrown box and have the user select a value from an overwhelming number of choices. I was hoping to use a DNN Suggest box to assist the user in selecting a valid value for both a name lookup and email lookup field. At that point, I wanted to populate a hidden field with the UseriD for the corresponding name lookup and emaili lookup.    

    Any suggestions? Thanks.

    billgUser is Offline
    going with the flow
    going with the flow
    Posts:31
    Avatar

    --
    05-19-2010 07:24 AM

    Chad,

    I just moved my client side javascript ($(txtEmail) = $(SugEmail)) from the $(SugEmail) field to the $(txtEmail) field and the javascript is populating the $(txtEmail) field. So, I think I may be okay for a while. I'll let you know if I get stuck again.

    The funny thing with the javascript is when I did an earlier one ($(Fullname = $(FirstName) + " " + $(LastName), I had to put the script in both the $(FirstName) and $(LastName) js client side boxes and as I popuated each textbox, the corresponding value was 'written' to the $(FullName) field. However, in this case, putting the js in the $(SugEmail) and having it popuate the $(txtEmail) did not work. Instead, I had to place the js in the result field ($(txtEmail). In both cases, the result field followed the source fields in sort order. Is there a 'rule of thumb' maybe that I am missing? Thanks.

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    05-19-2010 07:51 AM
    My recommendation would be that any field which might affect the results should have the JavaScript that is working properly. Typically once you have working JavaScript we recommend putting it in any field that might change that value and also under 'Initial JavaScript'. The reason why you need it under Initial JavaScript is that these values don't always get updated properly after a postback (such as checking validation etc...).

    -Chad
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    05-19-2010 07:54 AM
    Also - I would download and use FireBug 'Console Enabled' for FireFox. I use this a lot when I am coding client side events and it can be very helpful in determining why specific client side events are not working properly.

    Glad you were able to find a work around though and thanks for posting the follow up!

    Thanks,

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

    --
    05-19-2010 08:15 AM

    Chad, Don't worry about my last post (javascript). I think I just learned a bit about how it works. I would like to go back to my previous post and ask for your assistance.

    _________________________________________________

    Before I do, I wanted to mention that after a couple hours of testing, this is what I have uncovered. (1) the textbox needs to be hidden for the SQL to work (or at least not a 'standard' textbox). (2) If I enter a literal default value in the field settings, the SQL will work. (3) If I change the default value using a question event SQL, the SQL it does not work - regardless if the text field is hidden or not and regardless it there was an initial default value (in the field settings) or not. With that being said, on to my post..........

    _________________________________________________

    Chad,

    1. Can you tell me if the sort order of txtEmail is before or after the fields affected by the question event?

    --- Answer: --- txtEmail is before the field affected by the question event.
    2. Can you tell me if you make txtEmail a hidden field with a static value if that works?

    --- Answer: --- Yes. txtEmail as a hidden field with a static value works.
     

    This is really what I was trying to do---I have two DNN Suggest fields (SugName and SugEmail). I wanted the user to enter a (valid) value in each DNN Suggest field and have an SQL question event validate that both values (SugName and SugEmail) are correct for the same user record and if so, enter the UserID (for the SugName and SugEmail user)  in a hidden field.

    I tried setting up a question event for one of the DNN suggest fields but event though I have the option to select the Suggest field in the question event set up, when I selected a value from the SugEmail field, I did not get a question event postback. 

    So, I thought I would test using a text field and use client side javascript to populate the text field from the Suggest field - $(txtField) = $(SugField). However, when I put the client side javascript in the suggest field (it comes before the text field) and entered a value in the suggest field, the client side java script did not populate the text field. Go figure. 

    I don't really want to use a dropdrown box and have the user select a value from an overwhelming number of choices. I was hoping to use a DNN Suggest box to assist the user in selecting a valid value for both a name lookup and email lookup field. At that point, I wanted to populate a hidden field with the UseriD for the corresponding name lookup and emaili lookup.    

    Any suggestions? Thanks.

     

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    05-20-2010 07:22 AM
    Hi... I think that there are a few problems with this and not sure it can work this way. One problem is that I am not sure textbox fields are used or not for question events with SQL... We have some precautions for these fields because of risks with SQL injection. The other issue is that I know for sure textbox fields can't currently 'fire' a question event. Are you wanting the user to click a button before the question event processes or just tab out of the 2nd textbox field?

    Also - You might want to setup a quick demo of this on www.betasprings.com and this way we might be able to see if there is a work around or use it for future enhancements as a case study to implement more features to allow for this.

    -Chad
    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