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!

Initial Javascript Issue - "DSParam1 not defined"
Last Post 03-01-2011 06:35 AM by Ryan Bakerink. 13 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
LordWhiteboardUser is Offline
wading in the water
wading in the water
Posts:20
Avatar

--
02-22-2011 11:48 PM
    I am splitting this post up into several posts because it is failing to create my thread. I'm doing this because it might be a post length issue - although previewing my post displays everything correctly.
    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-22-2011 11:49 PM
    Hi

    We are using DNN 5.04.04 and Dynamic Forms 3.40.41

    We're having a problem with the Dynamic Forms module not properly tokenizing/parsing the Javascript in Module Configuration -> Custom JavaScript File -> Initial Javascript section.

    With the following code, as it is in [url=http://www.datasprings.com/portals/0/demonstrations/demonstration%2031/images/demo31screenshots/Demo31Part2initialJavascript.jpg]Demonstation 31 Part 2[/url], we are getting the following error:
    $(DSParam1) = $(UniqueCompletionID)
    Error: DSParam1 is not defined
    Source File: http://192.168.0.44/ATM/js/dnncore.js
    Line: 23


    Line of dnncore.js that broke:
    if (sLoadHandlers != null)
       eval(sLoadHandlers);



    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-22-2011 11:50 PM
    We then tried doing a simple message box on $(DSParam1):
    alert($(DSParam1))
    Error: DSParam1 is not defined
    Source File: http://192.168.0.44/ATM/js/dnncore.js
    Line: 23

    Line of dnncore.js that broke:
    if (sLoadHandlers != null)
       eval(sLoadHandlers);




    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-22-2011 11:51 PM
    The message box also failed on other fields, like $(AnotherTextboxField). We tried modifying the code, but it didn't help:
    alert($DSParam1)
    Error: $DSParam1 is not defined
    Source File: http://192.168.0.44/ATM/js/dnncore.js
    Line: 23


    Line of dnncore.js that broke:
    if (sLoadHandlers != null)
       eval(sLoadHandlers);


    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-22-2011 11:51 PM
    We finally hacked together a workaround for this problem, which is below. I'm showing you all our code, which works perfectly.
    This works.

    // Thanks to broofa over at
    // http://stackoverflow.com/questions/...javascript
    function getGUID() {
       return 'xxxxxxxx-xxxx-yxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
          var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
          return v.toString(16);
       }).toUpperCase();
    }

    // Thanks to Steven Levithan
    // http://blog.stevenlevithan.com/arch...javascript
    function trim10(str) {
       var whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
       for (var i = 0; i < str.length; i++) {
          if (whitespace.indexOf(str.charAt(i)) === -1) {
             str = str.substring(i);
             break;
          }
       }
       for (i = str.length - 1; i >= 0; i--) {
          if (whitespace.indexOf(str.charAt(i)) === -1) {
             str = str.substring(0, i + 1);
             break;
          }
       }
       return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
    }

    // Our code starts here:
    var UCID = null;
    if (UCID == null) {
       UCID = getGUID();
    else {
       UCID = trim10(UCID);
       if (UCID.length == 0) {
          UCID = getGUID();
       }
    }
    alert("UCID == " + UCID);
    document.getElementById("dnn_ctr404_DynamicForms_Responses_89d41257-36e1-49be-8d35-f04af8a8f6e7DSParam1").value = UCID;
    document.getElementById("dnn_ctr404_DynamicForms_Responses_e463cc33-0200-4018-8360-19b0f9a82b08UniqueCompletionID").value = UCID;

    alert("dnn_ctr404_DynamicForms_Responses_89d41257-36e1-49be-8d35-f04af8a8f6e7DSParam1 = " + document.getElementById("dnn_ctr404_DynamicForms_Responses_89d41257-36e1-49be-8d35-f04af8a8f6e7DSParam1").value);
    alert("dnn_ctr404_DynamicForms_Responses_e463cc33-0200-4018-8360-19b0f9a82b08UniqueCompletionID = " + document.getElementById("dnn_ctr404_DynamicForms_Responses_e463cc33-0200-4018-8360-19b0f9a82b08UniqueCompletionID").value);
    This works. However, we will now have to do a similar hack on all the pages of our form, taking into account the exact control names of DSParam1 and UniqueCompletionID on each form. Right now, the user could have eight pages to fill in, which means a lot of repetitive work and double checking on our side.

    What is wrong with "$(DSParam1) = $(UniqueCompletionID)", why is it not working and what can we do to fix it please?

    We are evaluating your product with the idea to buy it. Our purchasing decision could hang on the support that we receive from you on this issue.

    Thank you
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    02-23-2011 06:17 AM
    Hello LordWhiteboard,

    I think that you were over complicating this functionality. Demonstration 31 has been moderated slightly so my guess is that you're missing some keynotes.

    First of all you will want a hidden field with the SQL default of a GUID. Then you will use that as a uniqueCompletionID to pass from page to page. You won't use the Pass UniqueCompletionID to Session Variable.

    Sorry you had to go through hoops and all of this unnecessary research.

    -Ryan
    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-24-2011 02:01 AM
    This post will be split up into multiple posts as it appears that it is once again too long.

    Hi

    Good news, we got it to populate a textbox. The bad news is that we are disappointed at the new set of hoops that we had to jump through in order to get your product to work.

    I am putting the steps that we went through here so that anyone else who has a similar issue can find a resolution too. The steps:
    1. We created a hidden field that is SQL Driven called "InitGUID" that retrieves and passes it's value via querystring. Default value: "SELECT NEWID()) AS DefaultValue;"
    2. We submitted page one of our form, and got an error saying that SQL Server couldn't convert "" into a GUID. It turns out that the field was not populated.
    3. We made InitGUID visible so that we could see if it was being populated or not without having to submit our form.
    4. We fired up SQL Server Profiler to check if the code was actually being executed and found that it was actually being executed on the database server.
    5. We then tried the following query: "Select count(*) As DefaultValue from users" This failed to execute because we (obviously, seeing as it was just an example that you gave) don't have a "users" table in our database. So we then tried "SELECT COUNT(*) AS DefaultValue FROM dbo.ATM_DynamicForms_Question"  which successfully populated the textbox.


    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-24-2011 02:05 AM

    1. We then tried the following (the SELECT statements were tried on the server before being inputted as the query for InitGUID) as we weren't sure if the program was parsing our SQL Statement incorrectly:
      -- Let's try selecting from a table
      CREATE TABLE ATM_Tables_BobbyTables
      (
         MyStupidGUIDWorkaround UNIQUEIDENTIFIER NOT NULL
      )
      INSERT INTO dbo.ATM_Tables_BobbyTables (MyStupidGUIDWorkaround) VALUES (NEWID())

      -- Including indentation!
      SELECT
          atbt.MyStupidGUIDWorkaround AS DefaultValue
      FROM
          dbo.ATM_Tables_BobbyTables AS atbt

      -- Without the table alias, including indentation
      SELECT
          MyStupidGUIDWorkaround AS DefaultValue
      FROM
          dbo.ATM_Tables_BobbyTables

      -- Without the table alias and without indentation
      SELECT MyStupidGUIDWorkaround AS DefaultValue FROM dbo.ATM_Tables_BobbyTables

      -- Let's try not aliasing the column
      DROP TABLE ATM_Tables_BobbyTables
      CREATE TABLE ATM_Tables_BobbyTables
      (
         DefaultValue UNIQUEIDENTIFIER NOT NULL
      )
      INSERT INTO dbo.ATM_Tables_BobbyTables (DefaultValue) VALUES (NEWID())

      -- Without the table alias and without indentation
      SELECT DefaultValue FROM dbo.ATM_Tables_BobbyTables

    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-24-2011 02:07 AM
    1. Nothing worked.
    2. Then it struck me that an INT was successfully populated as a value for the textbox, so the textbox should *SURELY* be able to handle a string. Sooooo.....
      DROP TABLE ATM_Tables_BobbyTables
      CREATE TABLE ATM_Tables_BobbyTables
      (
         DefaultValue CHAR(36) NOT NULL
      )
      INSERT INTO dbo.ATM_Tables_BobbyTables (DefaultValue) VALUES (NEWID())

      SELECT DefaultValue FROM dbo.ATM_Tables_BobbyTables
    3. That worked!
    4. My query is now "SELECT CONVERT(CHAR(36),NEWID()) AS DefaultValue;"

    Where can I submit a bug report that SQL Driven textboxes can't be populated with a UNIQUEIDENTIFIER?

    Thank you
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    02-24-2011 06:37 AM
    Hello LordWhiteboard,

    Why wouldn't you use this SQL for your SQL default:

    Select Cast(NewID() as nvarchar(36)) as DefaultValue

    If you have any questions please let me know.

    Thanks,

    Ryan
    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    02-27-2011 11:13 PM
    Hi Ryan

    Posted By Ryan Bakerink on 02-24-2011 08:37 AM
    Hello LordWhiteboard,

    Why wouldn't you use this SQL for your SQL default:

    Select Cast(NewID() as nvarchar(36)) as DefaultValue

    If you have any questions please let me know.

    Thanks,

    Ryan

    Posted By LordWhiteboard on 02-24-2011 04:07 AM
    1. My query is now "SELECT CONVERT(CHAR(36),NEWID()) AS DefaultValue;"

    Or are you referring to our choice of datatype? We're using CHAR as opposed to NVARCHAR because GUIDs are ALWAYS going to be 36 characters in length and only use [0-9], [A-F/a-f] and "-" i.e. plain old ASCII characters.

    Thanks.

    Where can I submit a bug report that SQL Driven textboxes can't be populated with a UNIQUEIDENTIFIER?

    Thank you.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    02-28-2011 06:33 AM
    Hello LordWhiteboard,

    Yes you can use a CHAR data type if you'd like, I just always use nvarchar as a habit.

    There aren't any known issues with a SQL default in a textbox that acts as a unique identifier. What exactly happens?? Can you please let me know what makes you think this is a bug or if any errors come about.

    Thanks,

    Ryan
    LordWhiteboardUser is Offline
    wading in the water
    wading in the water
    Posts:20
    Avatar

    --
    03-01-2011 12:04 AM
    Hi Ryan

    When we don't cast the UNIQUEIDENTIFIER as a CHAR (or VARCHAR) the textbox is not populated. We _have_ to send an INT or one of the character data types to the textbox in order for it to populate.

    Thanks
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    03-01-2011 06:35 AM
    Hello LordWhiteBoard,

    The method "NewId()" refers to a unique identifier STRING. If you need a unique id that's an integer then you could do something like in these pages:

    http://stackoverflow.com/questions/...-composite

    OR

    http://www.sqlservercurry.com/2007/12/generate-unique-number-in-sql-server.html

    If you have any questions please let us know.

    Thanks,

    Ryan
    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