This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.
|
|
GEEK I have a problem using a submit function in the IHTMLFormElement interface. The HTML page I am controlling has multiple submit buttons. After calling the submit method, the server script doesn't properly recognize which button has been pressed.
GEEK The solution for this is quite simple. The <input type="submit"> element can have both a name and a value that can be used to distinguish it, thus allowing multiple submit buttons on a single form, or allowing multiple forms to submit to the same backend processing. Figure 1 shows two ways to do this. GEEK How can I pass an array of objects to a VBScript-based ASP application? I can do it easily when I'm using a Visual Basic®-based program, but I can't get it to work with VBScript.
GEEK How do you pass a value from one HIDDEN-type input to another on an HTML page without using an HTML form? If I have a line like this in an ASP script |
|
I want to take the value of the BNAME button and pass it from one page to another like this: |
|
GEEK You're going about this in a slightly incorrect fashion. For an <input type="hidden"> value to be passed to another page, it either has to be part of a <FORM>, or you have to physically force its use as part of the URL reference.
For the following code to work, the URL used to navigate to this page needs to include "?BNAME=value": |
|
As you know, the easiest way to do this is through the use of a <FORM> on the previous page, but this isn't the only way to move a value across pages.
Since you are already building the originating page using ASP, it would be more straightforward to insert this value into the link used to get to the second page, instead of including it as an <input type="hidden"> value. So on your originating page, you would use code such as: |
|
If you can make assumptions about the scripting capabilities of the client used to view the page, there's another
way to do this. Instead of making a simple URL link, you could make a click on the link activate the submit method of a hidden form.
GEEK Do you know of any mechanism that can provide a mutex code block/critical section in an ASP script? I have a critical piece of code that will be writing files to the server's disk and don't want multiple users to hit it at the same time. The code is currently written in VBScript.
|
|
Here, the lock/unlock prevents two users from simultaneously updating the NumVisits counter.
It sounds like you might need a slightly more robust usage, something more along the lines of: |
|
Here you use Lock and Unlock to protect the testing (and perhaps setting) of the bUnlocked variable. Upon exit from this test, the local haveAccess variable indicates whether you own the mutex. You then perform the appropriate manipulations, being sure to reset the bUnlocked state back to true once you have finished with your critical processing.
GEEK In your February 1997 column, you responded to an inquiry on the availability of redir.dll by saying a stripped-
down version was being prepared for people to use. Is there any news
on this yet?
In a follow-up column I presented the following ASP code that essentially duplicates the functionality of redir.dll. |
|
Between <% and %> is the script code that will be executed by the server. Here is the HTML code that you might use to interface with this: |
|
One of the primary benefits of something like this is that the code is easily modified without having to have a full C programming environment and distribution method. If the previous code doesn't quite do what you want it to do on your site, you can easily customize its behavior. A released version of redir.dll might not have suited your needs.
GEEK I'm running Microsoft® Internet Explorer 4.0 in kiosk mode, and would like to provide a button on an HTML page that will close Internet Explorer 4.0 completely when clicked. Is this possible?
|
|
When you try this, you'll notice that it will bring up a dialog box telling the user that the current page is attempting to close down the active browser window. This is a security feature and cannot be avoided.
However, if the window was opened by the current domain, then it can be closed without this warning. Here is some sample code to illustrate this: |
|
Run this code and click on the window.close button. You'll get the warning dialog. Choose not to allow the window to be closed down. Now click on the window.open button. This will open a new instance of the browser in kiosk mode. Then click on the window.close button, which will close down the browser without warning.
GEEK In Visual InterDev I have a simple page with two comboboxes, an edit field, and a Save button. I'm using DTC server components for all of these controls. The first combobox, Projects, is bound to a DTC Recordset control. The second combobox, Vendors, is populated in the Projects combobox's OnChange event and also in the Projects combobox's bound Recordset control's DataComplete event, with all the Vendors available for a given project. The textbox value needs to be written to a table when the user presses the Save button. In Visual Basic, all you need to do is load both comboboxes and press the Save button to write the textbox value. Whenever I click on a new item in the Projects or Vendors combobox, the page reloads and resets all the values. If I click on the Save button, the page reloads and I lose all my values. Why?
If you can make sure that Internet Explorer 4.0 is being used as the browser, then you can turn on client-side rendering via Dynamic HTML and ADO or RDS. To do this, select Document in the control's Properties window, then start up the Custom dialog. In this dialog you will see a place to set the scripting platform to either Client or Server. Set it to Client, then apply this change. There will still be a client/server round-trip invoked, but it will be happening in the background via ADO or RDS, so the page won't redraw.
|