Insert ID from DNN Suggest selection
Last Post 10-31-2012 06:57 AM by Michael Man. 4 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
PaulUser is Offline
going with the flow
going with the flow
Posts:42
Avatar

--
08-09-2010 07:43 PM
    Hi
    I have created a DNN Text Suggest field that is working fine. I want to submit the selection to a custom table in my db. I am presented with the option to submit the text from the field but I really want the Row ID only.  How can I get the row id of the selected option from the selection to submit to db. My SQL insert script is something like this;
    INSERT INTO  [UsersInEntities](
    [VendorId],
    [UserID]
    )
    VALUES (
    '$(ID)',
    '$(ID)'
    )
    This generated an error

    Conversion failed when converting the varchar value '$(ID)' to data type int.


    Any suggestions?
    Paul
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    08-10-2010 09:58 AM
    Hi Paul,

    I don't really know that Dynamic Forms can do this... If that was the case you would want to use a dropdownlist or other type of listbox field where you could pull in the QuestionOption and QuestionOptionValue.

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

    --
    08-10-2010 03:36 PM
    Thanks Chad
    The initial SQL for the Suggest field is;
    select UserID as ID, FirstName as Name from Users order by UserName

    So it would seem I have captured the ID? but it may just be in the wrong format ie. varchar instead of the required int? maybe I can convert the initial call to int somehow?
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    08-11-2010 08:40 AM
    Hi,

    This might be the situation for what the JavaScript/Text Suggest functionality requires in order to pull up the actual values as you type... but this isn't something that the textbox has access to at all whenever we save the data within Dynamic Forms (it couldn't be because you also don't HAVE to enter one of those suggestions, you can enter any text you want... I suppose you could modify the JavaScript within the dnntextsuggest.js file of DNN to maybe update a hidden field or something but other then that I don't know the way to do it.

    One option might be to use a SQL Event, pass in the 'Text' that was entered, then retrieve from your table the 'ID' that matches that text in the database and from there update any/all tables with the ID instead of that Text. That would be my best suggestion.

    Thanks,

    Chad
    Michael ManUser is Offline
    river guide
    river guide
    Posts:152
    Avatar

    --
    10-31-2012 06:57 AM
    Posted By Chad Nash on 08-11-2010 10:40 AM
    Hi,

    This might be the situation for what the JavaScript/Text Suggest functionality requires in order to pull up the actual values as you type... but this isn't something that the textbox has access to at all whenever we save the data within Dynamic Forms (it couldn't be because you also don't HAVE to enter one of those suggestions, you can enter any text you want... I suppose you could modify the JavaScript within the dnntextsuggest.js file of DNN to maybe update a hidden field or something but other then that I don't know the way to do it.

    One option might be to use a SQL Event, pass in the 'Text' that was entered, then retrieve from your table the 'ID' that matches that text in the database and from there update any/all tables with the ID instead of that Text. That would be my best suggestion.

    Thanks,

    Chad

    I know this post is long time ago but is there a fix for this since then? I want to do exactly what the original poster did. I want to be able to submit Insert into a table using SQL on completion event by inserting the ID instead of the Name.


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