Results 1 to 11 of 11

Thread: button help

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    10

    Cool button help

    hey this button moves an item from one menu to another and it should on click also post to the database but i dont think i have it right its an update command for the database called MM_editAction

    <input type="button" name="Enable" value=" <-" style="width: 45px;" onClick="MoveOption(this.form.DEPT_ID, this.form.CURRENTDEPT_ID)""<%=MM_editAction%>">

    any help would be greatly appreciated

  2. #2
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: button help

    is this in asp code or in the HTML?

    if its just in the HTML then ..

    <input type="button" name="Enable" value=" <-" style="width: 45px;" onClick="MoveOption(this.form.DEPT_ID, this.form.CURRENTDEPT_ID)<%=MM_editAction%>">

    If its <%= then you dont need any quotes .. its just like typing HTML there ..

    Whats a typical value of : MM_editAction

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    10

    Re: button help

    Quote Originally Posted by rory
    is this in asp code or in the HTML?

    if its just in the HTML then ..

    <input type="button" name="Enable" value=" <-" style="width: 45px;" onClick="MoveOption(this.form.DEPT_ID, this.form.CURRENTDEPT_ID)<%=MM_editAction%>">

    If its <%= then you dont need any quotes .. its just like typing HTML there ..

    Whats a typical value of : MM_editAction
    this is in the html its the button inside it thats what its told to do MM_editAction would be going into the doctor_matrix based on the values in teh table looking for the DEPTCONTACT_ID from the table and if its different or added it will do teh appropiate action!

  4. #4
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: button help

    <%=MM_editAction%>

    means you are assigning a value from ASP (vbscript) ..

    what would this typically look like ..?
    Is it a seperate event ..?

    Right now you are doing ..
    onClick="MoveOption(this.form.DEPT_ID, this.form.CURRENTDEPT_ID)<%=MM_editAction%>"

    so it is calling the Javascript function MoveOption with the values DEPT_ID and CURRENTDEPT_ID ..

    Is MM_editAction additional Javascript or something else ..?
    Does MoveOptions contain 3 values?? Can you post that script or at least the function start?

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    10

    Re: button help

    how do i attact the page????

  6. #6
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: button help

    got down to manage attachments .. click that and upload the page/s ... submit and it will be there for me to download .. you can always goto your User CP and manage attachments and delete the attachements .

    Rory
    Last edited by rory; Jun 22nd, 2006 at 04:44 PM.

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    10

    Re: button help

    here they are
    Attached Files Attached Files

  8. #8
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: button help

    Ok .. golly .. thats gotta be 100 times slower than it could be ... anyway .. you just want it to work right now ..?

    Anyway that code is all mixed up, with different client side scripts not being named as types .. anyway, here is a basic example ..

    VB Code:
    1. <html>
    2. <head>
    3. <script language="javascript">
    4.     <!--
    5.     function MoveOption(objSourceElement)
    6.     {
    7.         alert(objSourceElement);
    8.     }
    9.     //-->
    10.     </script>
    11.  
    12. <SCRIPT LANGUAGE="VBScript">
    13. sub Execute_cmd(val1)
    14.     msgBox val1
    15.     MoveOption val1
    16. end sub
    17. </script>
    18. </head>
    19. <body>
    20.  
    21. <form name="test">
    22. <select size="1" name="DEPT_ID">
    23. <option value="test1">test1</option>
    24. <option value="test2">test2</option>
    25. </select>
    26. <input type="button" onClick="Execute_cmd(document.test.DEPT_ID.options[document.test.DEPT_ID.selectedIndex].value)" value="Submit">
    27. </form>
    28.  
    29. </body>
    30. </html>

  9. #9
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: button help

    And here is where the errors are ..

    MoveOption has only 2 values to it ..

    MoveOption this.form.DEPT_ID, this.form.CURRENTDEPT_ID
    And these values are incorrect as it is ..

    Then MM_editAction is a variable containing the page link and querystring ..

    eg. http://www.web.com/department.asp?this=that

    Is after the MoveOption script called, do you want it to redirect to another page ..?? If so you would put that in the MoveOption javascript function and use Location.Href = MM_editAction; after the script has done its work ..

    This whole thing really needs a rewrite iMO but anyways .. :-)

    VB Code:
    1. <script>
    2.     <!--
    3.     function MoveOption(objSourceElement, objTargetElement)
    4.     {
    5.         var aryTempSourceOptions = new Array();
    6.         var x = 0;
    7.        
    8.         //looping through source element to find selected options
    9.         for (var i = 0; i < objSourceElement.length; i++) {
    10.             if (objSourceElement.options[i].selected) {
    11.                 //need to move this option to target element
    12.                 var intTargetLen = objTargetElement.length++;
    13.                 objTargetElement.options[intTargetLen].text = objSourceElement.options[i].text;
    14.                 objTargetElement.options[intTargetLen].value = objSourceElement.options[i].value;
    15.             }
    16.             else {
    17.                 //storing options that stay to recreate select element
    18.                 var objTempValues = new Object();
    19.                 objTempValues.text = objSourceElement.options[i].text;
    20.                 objTempValues.value = objSourceElement.options[i].value;
    21.                 aryTempSourceOptions[x] = objTempValues;
    22.                 x++;
    23.             }
    24.         }
    25.        
    26.         //resetting length of source
    27.         objSourceElement.length = aryTempSourceOptions.length;
    28.         //looping through temp array to recreate source select element
    29.         for (var i = 0; i < aryTempSourceOptions.length; i++) {
    30.             objSourceElement.options[i].text = aryTempSourceOptions[i].text;
    31.             objSourceElement.options[i].value = aryTempSourceOptions[i].value;
    32.             objSourceElement.options[i].selected = false;
    33.         }
    34.     }
    35.     //-->
    36.     </script>
    37.    
    38. </head>
    39. <body>
    40.  
    41. <SCRIPT LANGUAGE="VBScript">
    42. sub Execute_cmd()
    43.     MoveOption this.form.DEPT_ID, this.form.CURRENTDEPT_ID
    44.     <%=MM_editAction%>
    45. end sub
    46. sub Execute_cmd2()
    47.     MoveOption this.form.CURRENTDEPT_ID, this.form.DEPT_ID
    48.     <%=MM_editAction%>
    49. end sub
    50. </script>
    51.  
    52. <input type="button" name="Disable" value="->" style="width: 45px;" onClick="Execute_cmd;">

  10. #10
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: button help

    another simple example of making somethings better would be ..

    Put Most of it in Subs and Functions ..
    seperate all HTML from ASP .. ASP first then write out the HTML using Varibles ..

    or at least make the variables first instead of putting database values right into the HTML ..

    Get rid of all the Open and Closes .. eg .. dont need ..
    %>
    <%
    Slows the script down ..

    I dont see any kind of error checking in there also .. Seperate different types of procedures into their own include files .. eg. The Upload code could go in something like modUpload.asp ... a class would be nice but even if the basics are covered it would be alot easier to maintain and work with .. even so .. i see alot of errors .. which may not bring up errors but will definately slow the script down very very much ..

    Basically the whole thing needs a revamp .. ;-)

    Also instead of all those Dim Statements ..
    VB Code:
    1. '*** Pure ASP File Upload 2.1.7
    2. Dim GP_uploadAction,UploadQueryString
    3. PureUploadSetup
    4. If (CStr(Request.QueryString("GP_upload")) <> "") Then
    5.   Dim RequestBin, UploadRequest  
    6.   Const pau_thePath = """/images/doctors"""
    7.   Const pau_Extensions = "GIF,JPG,JPEG"
    8.   Const pau_Form = "providersAdd"
    9.   Const pau_Redirect = ""
    10.   Const pau_storeType = "file"
    11.   Const pau_sizeLimit = ""
    12.   Const pau_nameConflict = "over"
    13.   Const pau_requireUpload = "false"
    14.   Const pau_minWidth = ""
    15.   Const pau_minHeight = ""
    16.   Const pau_maxWidth = ""
    17.   Const pau_maxHeight = ""
    18.   Const pau_saveWidth = ""
    19.   Const pau_saveHeight = ""
    20.   Const pau_timeout = "600"
    21.   Const pau_progressBar = ""
    22.   Const pau_progressWidth = "300"
    23.   Const pau_progressHeight = "100"
    24.   CheckPureUploadVersion 2.17
    25.   Call ProcessUpload(pau_thePath, pau_Extensions, pau_Redirect, pau_storeType, pau_sizeLimit, _
    26.                      pau_nameConflict, pau_requireUpload, pau_minWidth, pau_minHeight, pau_maxWidth, _
    27.                      pau_maxHeight, pau_saveWidth,pau_saveHeight,pau_timeout)
    28.  
    29. end if

  11. #11

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    10

    Re: button help

    Quote Originally Posted by rory
    another simple example of making somethings better would be ..

    Put Most of it in Subs and Functions ..
    seperate all HTML from ASP .. ASP first then write out the HTML using Varibles ..

    or at least make the variables first instead of putting database values right into the HTML ..

    Get rid of all the Open and Closes .. eg .. dont need ..
    %>
    <%
    Slows the script down ..

    I dont see any kind of error checking in there also .. Seperate different types of procedures into their own include files .. eg. The Upload code could go in something like modUpload.asp ... a class would be nice but even if the basics are covered it would be alot easier to maintain and work with .. even so .. i see alot of errors .. which may not bring up errors but will definately slow the script down very very much ..

    Basically the whole thing needs a revamp .. ;-)

    Also instead of all those Dim Statements ..
    VB Code:
    1. '*** Pure ASP File Upload 2.1.7
    2. Dim GP_uploadAction,UploadQueryString
    3. PureUploadSetup
    4. If (CStr(Request.QueryString("GP_upload")) <> "") Then
    5.   Dim RequestBin, UploadRequest  
    6.   Const pau_thePath = """/images/doctors"""
    7.   Const pau_Extensions = "GIF,JPG,JPEG"
    8.   Const pau_Form = "providersAdd"
    9.   Const pau_Redirect = ""
    10.   Const pau_storeType = "file"
    11.   Const pau_sizeLimit = ""
    12.   Const pau_nameConflict = "over"
    13.   Const pau_requireUpload = "false"
    14.   Const pau_minWidth = ""
    15.   Const pau_minHeight = ""
    16.   Const pau_maxWidth = ""
    17.   Const pau_maxHeight = ""
    18.   Const pau_saveWidth = ""
    19.   Const pau_saveHeight = ""
    20.   Const pau_timeout = "600"
    21.   Const pau_progressBar = ""
    22.   Const pau_progressWidth = "300"
    23.   Const pau_progressHeight = "100"
    24.   CheckPureUploadVersion 2.17
    25.   Call ProcessUpload(pau_thePath, pau_Extensions, pau_Redirect, pau_storeType, pau_sizeLimit, _
    26.                      pau_nameConflict, pau_requireUpload, pau_minWidth, pau_minHeight, pau_maxWidth, _
    27.                      pau_maxHeight, pau_saveWidth,pau_saveHeight,pau_timeout)
    28.  
    29. end if

    when u say total revamp what do u mean i'm totally new to this i need all the help i can get the code u posted whats it for like does it replace something let me know i really really appreciate all this help man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width