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!

How to edit data with Dynamic Views?
Last Post 10-17-2012 05:38 AM by Ryan Bakerink. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
BrettUser is Offline
wading in the water
wading in the water
Posts:22
Avatar

--
10-16-2012 08:25 AM
    Is it possible to edit data using the dynamic views module?

    I have created a form using the Dynamic Forms module.
    This form submits to a SQL table that I created manually called "Customers".

    I would like to display the data from this table using the Dynamic Views module and have the ability to add, update and delete records.

    Is this possible?

    I have tried following demo 30 below but it does not allow me to edit the data.
    http://www.datasprings.com/products...ms-demo-30
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-16-2012 09:37 AM
    Hello Brett,

    The answer is yes.

    Dynamic Form Question Addition #1:
    You'll need to add another Question of type Hidden field to your Dynamic Form. Lets give it a shortname of "DSParam1". Make sure this Hidden field has Retrieve from Querystring enabled.

    Dynamic Form Question Addition #2:
    You'll need to add a Question of type Hidden field to your Dynamic Form. Lets give it a shortname of "DBUpdate". Give this hidden field a Default Hardcoded value to "False". Make sure this Hidden field has Retrieve from Querystring enabled.

    Dynamic Form Question Event #1:
    Then you'll want to build an INSERT SQL COMPLETION EVENT, which sounds like you already have. However this will only fire when DBUpdate = False

    Dynamic Form Question Event #2:
    Add a SQL COMPLETION EVENT to handle the Update of a record on your Dynamic Form. This will only fire when DBUpdate = True.


    NOW FOR THE DYNAMIC VIEW SECTION:

    You need to pay attention to what the Primary key is for your custom SQL table. In this example it will be "ResultID".

    Add a hyperlink into your Dynamic View template with the HREF set to the URL to the Dynamic Form page.

    Let's say this is where your Dynamic Form is located:
    www.yoursite.com/DynamicForm

    This is what the Edit hyperlink path would look like(Replace "[" and "]" with "<" and ">"):
    [a href="www.yoursite.com/DynamicForm?DSParam1=[resultid]&DBUpdate=True"]EDIT RECORD[/a]

    The whole idea is to get the Dynamic Form to act differently depending on different conditions. So it's sort of like you'll have an INSERT and an UPDATE mode.

    INSERT mode is depicted by DBUpdate = False
    UPDATE mode is depicted by DBUpdate = True

    Now for the fun part on the Dynamic Form. You'll need to go to Module Configuration -> Advanced Coding Options -> Initial SQL Rendering / Bind

    * Enable this feature.
    * Make this fire only when DBUpdate is present as a Querystring in the URL.

    Build your SQL Query to return only 1 record, if your SQL table is named "SQLTable" then please build a similar query:

    Select * from SQLTable where ResultID = '$(DSParam1)'

    NOTE: The column named returned from SQLTable need to match up exactly with questions on your Dynamic Form in order to successfully map column data from your table to your Dynamic Form.

    If you need more information on this functionality. Please review Demonstration 31:

    http://www.datasprings.com/formdemos

    Thanks,

    Ryan









    BrettUser is Offline
    wading in the water
    wading in the water
    Posts:22
    Avatar

    --
    10-17-2012 05:09 AM
    Thanks for the detailed explanation. It wasn't clear from the demo that you needed to link back to the dynamic form page in order to edit. I thought dynamic views did this automatically.

    I was able to get this to work after following your instructions.

    One other question though.

    The edit link I am using looks like this:
    http://www.yoursite.com/DynamicForm...pdate=True

    The form is available to all users.

    How do I restricting editing to administrators only?





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

    --
    10-17-2012 05:38 AM
    Hello Brett,

    In your Initial SQL Binding Query, you can add in a condition to check the role of the person logged in. Also return an Extra Column in your Initial SQL Bind:


    DECLARE @InRole int

    -- This is checking to see if the user viewing the page is an Administrator
    Set @InRole = (Select Count(*) from UserRoles where UserID = '$(UserID)' and RoleID = 0)

    IF @InRole > 0
    BEGIN
    /*
    Perform your current SQL Query. Return the @InRole variable as a column
    Your query may look like this:

    Select *, @InRole As RoleCheck from SQLTable where ResultID = '$(DSParam1)'

    Select
    */
    END
    ELSE
    BEGIN
    /*
    Don't perform the current SQL query. But return the @InRole variable as a Column.
    Your query may look like this:

    Select @InRole As RoleCheck

    */
    END


    Now add a new Question to your form of type Hidden. And give it a shortfield name of "RoleCheck". This will ensure that 1 will be stored in this hidden field if the user is an Admin, or 0 if the user isn't an Admin.

    You can now build JavaScript to disable the Submit button if "RoleCheck" = "0" and "DBUpdate" = "True". Enable the Submit Button if "DBUpdate" = "False"

    Let me know if you have any questions.

    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