#1
|
|||
|
|||
HTML form linking into scripts
Hi all,
I am interested in taking the html form a bit further than done in the whitepaper. Unfortunately, I am running into some trouble linking the message handler from the html form to the script. I'm sure I'm missing something pretty dumb. I would appreciate any insight you could lend! First, the form: I found a form builder at www.phpform.org. It makes a nice looking form and is quite user friendly. Second: I can make the form open correctly from the script using the Scripting Essentials instructions. I only change the g_objIE.Navigate call to reference the local copy of form.html file that phpform.org spit out. Third: This is the part I am having trouble with. I can't seem to get the "Run Test" button to link with the script. I have added the ButtonHandler variable to the form.html file and the onclick=Document.All("ButtonHandler").Value to the button. But the two do not seem to communicate. Below is a snippet of both the form.html file and my script. form.html: ----------------------------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>8x1G PIM/NIM Bench Test</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>8x1G PIM/NIM Bench Test</a></h1> <form id="form_126128" class="appnitro" method="post" action=""> <div class="form_description"> <h2>8x1G PIM/NIM Bench Test</h2> <p>This form will define how the 8x1G PIM/NIM will be bench-tested. </p> </div> <ul > <li id="li_1" > <label class="description" for="element_1">Tester Name </label> <div> <input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value=""/> </div><p class="guidelines" id="guide_1"><small>Please enter your name here</small></p> </li> <li id="li_2" > <label class="description" for="element_2">Board Serial Number </label> <div> <input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/> </div><p class="guidelines" id="guide_2"><small>Please enter the board's serial number here. This value will be programmed into the board's eeprom</small></p> </li> <li id="li_3" > <label class="description" for="element_3">MAC Address </label> <span> <input id="element_4_1" name="element_4_1" class="element checkbox" type="checkbox" value="1" checked="checked"/> <label class="choice" for="element_4_1">Auto Login</label> <input id="element_4_2" name="element_4_2" class="element checkbox" type="checkbox" value="1" checked="checked"/> <label class="choice" for="element_4_2">Program Board Parameters</label> </span><p class="guidelines" id="guide_4"><small>Please select which tests you would like to perform. These tests are to be done when the board is sitting on a bench. </small></p> </li> <li class="buttons"> <input type="hidden" name="form_id" value="126128" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Run Selected Tests" Onclick=Document.All("ButtonHandler").Value="RunTest"/> <input name=ButtonHandler value="Nothing Clicked Yet" type=hidden > </li> </ul> </form> </div> </body> </html> VB Script: ----------------------------------------------------------------------- Sub Main Set g_objIE = CreateObject("InternetExplorer.Application") g_objIE.Offline = True g_objIE.Navigate "C:\Jason\Edge10_Testing_Script\form\form.html" Do crt.Sleep 100 Loop While g_objIE.Busy ' Skipped some formatting for brevity Do crt.Sleep 100 Loop While g_objIE.Busy Set objShell = CreateObject("WScript.Shell") objShell.AppActivate g_objIE.document.Title g_objIE.Document.All("element_1").Focus Do Select Case g_objIE.Document.All("ButtonHandler").Value Case "RunTest" ' The user clicked Submit. Exit the loop MsgBox "Run Test Button Clicked" g_objIE.quit Exit Do End Select crt.Sleep 200 Loop end Sub |
#2
|
||||
|
||||
Could it be that you're setting the value of your ButtonHandler to "RunTe st" instead of "RunTest"?
").Value="RunTe st"/>--Jake
__________________
Jake Devenport VanDyke Software Technical Support YouTube Channel: https://www.youtube.com/vandykesoftware Email: support@vandyke.com Web: https://www.vandyke.com/support |
#3
|
|||
|
|||
Hi Jake, thanks for the tip. Unfortunately, that wasn't it. I went simple and just replaced the generated button with a standard <button name=RunTest...> and that worked. So I am off and running again. Thanks again for the help!
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|