Change Submit Image on client side envent
Last Post 12-28-2009 07:15 AM by Benjamin Perez. 4 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Benjamin PerezUser is Offline
going with the flow
going with the flow
Posts:55
Avatar

--
12-23-2009 10:34 AM

    I have a form that updates the information from a table similar to this example.

    I have set up the submit button to be an image, but I would like to change the image on a client side event based on a hidden filed. This is what I have so far:

    Hidden Field: SQL with insert as default value and update and delete as values that are retrieved from query string.

    On the SQL hidden filed I have the following on the client side event filed:

    if ( $(SQL).toUpperCase() == 'INSERT')
            {
                  document.getElementById("dnn_ctr458_View_ctr451_View_ctr448_DynamicForms_imgSave").src = "/Portals/0/SiteImages/add.gif";
            }
    else
            {
                   document.getElementById('dnn_ctr458_View_ctr451_View_ctr448_DynamicForms_imgSave').src ="/Portals/0/SiteImages/Update.gif";
            }

    I copied the Element ID from the source code of the page containing the form but the script is not working at all.

    How can I make sure I am using the correct element ID?
    Is there another way that this can be done?
     

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    12-23-2009 10:47 AM
    HI, the best way to debug javascript is to use Mozilla Firefox with Firebug add on running. Firebug will tell you exactly where it errors out in the javascript. As for obtaining the correct elementID, simply right click on the element on the page and choose "Inspect Element". -- David
    Benjamin PerezUser is Offline
    going with the flow
    going with the flow
    Posts:55
    Avatar

    --
    12-23-2009 01:43 PM

    David,

    Thanks for the reply, but as far as I can tell, my script is correct but no change is being made, I have tried putting the script as part of the custom java script file and still not working.

    When I add the script to the client side event on the advance settings on the SQL field, I can't find the script on the source code of the page.

    Am I going the wrong direction to achieve what I want?

     

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    12-27-2009 04:16 PM
    HI, that's because the field is HIDDEN so the client side javascript never gets triggered. You need to place that same javascript in Module Configuration / Initial Javascript on page load. Try this out and see if it gets triggered. Be sure to use Firefox with Firebug to detect any errors. -- David
    Benjamin PerezUser is Offline
    going with the flow
    going with the flow
    Posts:55
    Avatar

    --
    12-28-2009 07:15 AM

    when I add the script as initial javascript I get SQL is not defined. if I un-hide the SQl field and add the code to the question event I get

    document.getElementById("dnn_ctr448_DynamicForms_TBR_GUIDaba5b2e3-86b6-406f-bf4e-6efd20a1b08bSQL") is null

    I am

    Retrieving

    the values from query string.



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