Why are my client-side javascript breakpoints not being hit? - visual-studio-2012

I'm setting forth on my first Single-Page Application. I've installed Visual Studio 2012 Professional with Update 2, and loaded the project. I've gone into IE10 and unchecked the "Disable script debugging (Internet Explorer)" checkbox.
Here's my code snippet that ought to be hit by the debugger
However, when I run the code the red breakpoint symbol turns to a hollow white one
with the legend "The breakpoint will not currently be hit; no symbols have been loaded for this document".
I'm at a loss here. Even the debugger; statement isn't causing the code to break out.
I've reinstalled VS2012 and Update 2 twice now.
Thanks
Edward

Do you have multipel projects in your solution, is the file where you are putting breakpoint belongs to same project that is set as start up project?

have you tried to give the function a name (openMain function name here)
Just to make it a bit more understandable I'll show a code that I used for a site.
<form name="myForm" action="mailto:kkatsman#rocfriesepoort.nl?subject=Stickers" enctype="text/plain" method="POST" onsubmit=" return formcheck()">
<table id="formulier">
<tr>
<td>Klas:</td> <td><input type="text" required name="klas" id="klas" onkeyup="vulaan(this)"></td>
</tr><tr>
<td>Examencode:</td> <td><input type="text" required name="examencode" id="examencode" onkeyup="vulaan(this)"></td>
</tr><tr>
<td>Examennaam:</td> <td><input type="text" required name="examennaam" id="examennaam" onkeyup="vulaan(this)"></td>
</tr><tr>
<td>Datum:</td> <td><input type="text" required name="datum" id="datum" onkeyup="vulaan(this)"></td>
<td colspan="2"></td>
<td>Week:</td> <td><input type="text" required name="week" id="week" onkeyup="vulaan(this)"></td>
</tr><tr>
<td>Tijdstip: van</td> <td><input type="text" required name="van" id="van" onkeyup="vulaan(this)"></td> <td>tot</td> <td><input type="text" required name="tot" id="tot" onkeyup="vulaan(this)"></td>
<td>Docent:</td> <td><input type="text" required name="docent" id="docent" onkeyup="vulaan(this)"></td>
</tr>
</table>
So when there is a keypressed in a certain textbox it refers to the function "vulaan"
now my javascript file looks something like:
function vulaan()
{
//voor de klas
var klas = document.getElementById('klas').value;
var klas1 = document.getElementById('klas1').value;
var klas2 = document.getElementById('klas2').value;
document.getElementById('klas1').value = klas;
document.getElementById('klas2').value = klas;
}

Related

Classic asp export to excel (with parameter)

I am using the education iSAMS software to produce a report, then export that data to Excel. Almost everything is written in Classic ASP, and it's a 2-frame window, containing Student IDs on the left frame, and a report for each student ID on the right frame. Click on a student of the left, and the report shows in the right pane.
The report uses the Student ID as a parameter :
paramBuilder.NextParameter(intID)
... and this works fine and produces the report from the SQL loop.
However, I'm unable to use the parameter in the Excel export part (I get the error "syntax error or access violation"). If I remove the parameter from the WHERE clause, the export works (although it exports all Student IDs, not just the one).
I've tried just about everything I can think of, but I still hit a brick wall. Is it possible to re-use this parameter in the export?
Thanks in advance.
Here is the code :
<!--#include file="../../system/includes/inc_security.asp"-->
<!--#include file="../../system/includes/inc_theme.asp"-->
<% 'viewstudent-test.asp-v111-11-09-2017 --Includes Export to Excel
'txtModule="iSAMS_SCHOOLDIRECTORY"
'txtContext="SDSTUDENT"
intID = request.querystring("id")
%>
<!--- SHOW THE SUBJECT REPORTS --->
<table border="1px" width="100%">
<tr>
<td>Subject</td>
<td>Subject Report</td>
</tr>
<%
sql = "SELECT DISTINCT txtSchoolID, txtID, txtCommentID, txtComment FROM CAN_Tbl_UCAS_Reports WHERE intReportType = 1 AND txtSchoolID = " & paramBuilder.NextParameter(intID) & " ORDER BY txtID"
Set rsRecord = Database.GetRs(sql, conn, paramBuilder.Parameters)
if not rsRecord.EOF then
do until rsRecord.EOF
' First we need to create our Variables
SchoolID = rsRecord("txtSchoolID")
ConID = rsRecord("txtCommentID")
Com = rsRecord("txtComment")
%>
<tr>
<td style="text-align:center; vertical-align:top; height:10px"><%Response.Write(rsRecord.Fields("txtID").value)%></td>
<td style="text-align:center">
<form action="updateform.asp" method="post">
<input type="hidden" name="ID" value="<%=ConID%>" />
<input type="hidden" name="SchoolID" value="<%=SchoolID%>" />
<textarea rows="3" cols="180" name="comment"><%=Com%></textarea>
</form>
<td>
</tr>
<%
rsRecord.Movenext
loop
end if
rsRecord.close
set rsRecord = nothing
%>
</table>
<%If Request("ACT")="xls" Then
'Build & Execute Your SQL Command
SQL = "SELECT DISTINCT txtSchoolID, txtID, SubjectTeacher, txtComment FROM CAN_Tbl_UCAS_Reports WHERE intReportType = 1 AND txtSchoolID = '" & intID & "' ORDER BY txtID"
Set rstSearch = conn.Execute(SQL)
'Set the HTTP Header
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=""Excel Export.xls"""
'Output Table %>
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>Header 1</th><th>Header 2</th><th>Header 3</th>
</tr><% Do While Not rstSearch.EOF %>
<tr>
<td><%=rstSearch(1)%></td><td><%=rstSearch(3)%></td>
</tr>
<% rstSearch.MoveNext : Loop %>
</table>
<%
'Stop Processing Page Now
Response.End
End If
%>
<form action="?" method="post">
<input type="hidden" name="ACT" value="xls">
<input type="submit" value="Export To Excel">
</form>
</body>
</html>
<!--#include file="../../system/connections/inc_dbconnclose.asp"-->

How to get input field embedded in table using page-object accessor

Given the HTML snippet below how can I, using page-object field accessors, get the second input field, the one with id="333:".
I can't use the id to identify the field as it's auto-generated.
Using page-object accessors I can get the embedded table and the correct cell but the cell object is a PageObject::Elements::TableCell which doesn't seem to have any methods that allow access to the embedded span and input field.
I can get the input field using native Watir accessors - i.e., browser.div( ... etc ...) but would prefer to use just page-object accessors if possible.
If not possible then I'll live with native Watir. Thanks
<div class="modalContent">
<table role="presentation" id="324:_layoutTbl" class="axial">
<tbody>
<tr>
<td>
<input id="326:" name="" value="" onchange="juic.fire("326:","_change",event);" onfocus="juic.fire("326:","_focus",event);" onblur="juic.fire("326:","_blur",event);" type="text">
</td>
</tr>
<tr>
<td class="sfTH">
<label for="332:">Users:</label>
</td>
<td>
<table class="noborder" role="presentation">
<tbody>
<tr>
<th>
<label id="336:" class="rcmFormLabel">Hiring Manager</label>
<label id="337:" for="333:" class="rcmFormLabe">Users, Hiring Manager</label>
</th>
<td><span class="autocompspan ">
<input class="autocompinput" id="333:" name="333:" onfocus="juic.fire("333:","_focus",event);" size="20" value="Bill Murray" role="combobox" type="text">
<input value="111111" id="333:_hidden" name="333:_hidden" type="hidden">
</span>
<div id="335:" style="display:none"><img alt="" class="globalFloatLeft">
<div id="335:_error" style="color:#ff0000">undefined is required</div>
<div style="clear:both;"></div>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
After more experimenting I found the answer to my question. I declared the table accessor, e.g., div(:my_table, :class => 'modalContent').table.table then in the code, to get the input field in the first row I did my_text_field = my_table_element[0].text_field_element which returned the PageObject::TextField object in column 2 of row 1

How can I differentiate between two POST calls in expressjs?

I currently have two different forms on one inven.ejs file:
One for simple description:
///inven.ejs
<form method="POST" value="inven">
<div id="some-form" style="display: none;">
<table>
<tr>
<td><label for="item">Item</label></td>
<td><input type="text" name="item" required/></td>
</tr>
<tr>
<td><label for="text-box-value">Value</label></td>
</tr>
<tr>
<td><label for="comments">Comments</label></td>
<td><textarea rows="4" cols="50" required></textarea></td>
</tr>
<tr>
<td><input type="submit" /></td>
</tr>
</table>
</div>
</form>
and another for file upload:
///inven.ejs
<div id="fileUp">
<form id="fileUpload" name="fileUpload" enctype="multipart/form-data" method="post">
<fieldset>
<input type="file"id="fileSelect">
<input type="submit" name="upload" value="upload">
</fieldset>
</form>
</div>
In express, how can I differentiate between these two posts in my list.js file?
router.post('/list', function(req,res){
// ???
});
Do I need two routers? Am I completely doing this incorrectly?
Thank you!
EDIT:
Included an image, if it helps?
It makes sense to have forms post to a different address.
That is, <form id="fileUpload" action="file_upload" ... >
Then, if the form is found at http://server/my_form, it will post to http://server/file_upload
In your Node.js router you need to catch that and done.
If you still desire to send both forms to the same address, you can then use hidden fields.
Example: <input type="hidden" name="form_type" value="file_up_form">. Then in your Node.js you check for the argument form_type and check its value.

Session Management in Liferay

How come I customize the session in Liferay?Sample codes are welcome as it will help more,I am pretty new to Liferay?
To be more specific, i'll explain what i've done. Using Custom JSPs Hooks , i have overridden the $PORTAL_ROOT_HOME/html/portlet/login login.jsp and created my own jsp page and also overridden the LoginAction class.My login.jsp page looks like:
<aui:form action="" method="post">
<table>
<tr>
<td>Username :</td>
<td><input name="login" size=15 type="text" /></td>
</tr>
<tr>
<td>Password :</td>
<td><input name="password" size=15 type="password" /></td>
</tr>
</table>
<aui:button type="submit" value="sign-in"/>
</aui:form>
Now please tell upon clicking on the submit button , how can i get the login values in LoginAction.java and hence set the values to session. This is what i mean by customizing.
You should have copied the origonal login.jsp file from the start. By the looks of your codesnipsets you forgot to set the action to your loginAction. This can be done the following way:
<portlet:actionURL secure="<%= PropsValues.COMPANY_SECURITY_AUTH_REQUIRES_HTTPS || request.isSecure() %>" var="loginURL">
<portlet:param name="saveLastPath" value="0" />
<portlet:param name="struts_action" value="/login/login" />
<portlet:param name="doActionAfterLogin" value="<%= portletName.equals(PortletKeys.FAST_LOGIN) ? Boolean.TRUE.toString() : Boolean.FALSE.toString() %>" />
</portlet:actionURL>
<aui:form action="<%= loginURL %>" method="post">
<table>
<tr>
<td>Username :</td>
<td><aui:input name="login" size=15 type="text" /></td>
</tr>
<tr>
<td>Password :</td>
<td><aui:input name="password" size=15 type="password" /></td>
</tr>
</table>
<aui:button type="submit" value="sign-in"/>
</aui:form>
Please note that it is better to copy the orginal $PORTAL_ROOT_HOME/html/portlet/login/ login.jsp to your hook. Then make the modifications if any needed.
Your Hook will break / remove allot of existing functionality if the provided snipset is all you have.
To receive the parameters from the action you can use Pauls answer.
You can get login values with this code:
String login = ParamUtil.getString(request, "login");
String password = ParamUtil.getString(request, "password");
To set some values to session use this:
HttpSession session = request.getSession();
session.setAttribute("parm", "somevalue");
BR,
Paul

Number of Search Results from Excel

Given a column of strings I would like to find the number of search results from a website (e.g. sciencedirect.com) for each string. An existing answer Number of Google Results from Excel works well for Google.
Unfortunately this solution creates the search URL from the string i.e. a Google search for example contains the word example. The sites I want to use do not do this.
A search for example returns the URL http://www.sciencedirect.com/science?_ob=ArticleListURL&_method=list&_ArticleListID=1860967815&_sort=r&_st=13&view=c&_acct=C000053194&_version=1&_urlVersion=0&_userid=1495569&md5=0ef30742e917da15236ef1824058a1db&searchtype=a
Any idea how I achived the same result with this type of search engine.
You'll have to examine the form you submit when you click on the Search button. The form sends a GET request which containes the search terms, but then you get redirected to the result list page, and the URL of the results page does not contain the search terms any more.
I have successfully searched for "corpus" with this URL:
http://www.sciencedirect.com/science?_ob=QuickSearchURL&_method=submitForm&_acct=C000228598&_origin=home&_zone=qSearch&md5=61ce8901b141d527683913a240486ac4&qs_all=corpus
Note that what you'll have to do is
download the start page http://www.sciencedirect.com/
extract hidden fields from the search form
assemble the search URL from the hidden fields
add your search term to the search URL in the qs_all field
send GET request with the search URL
follow redirection
Except for qs_all all other fields in this URL comes from the the form as hidden fields.
This is the source of the corresponding form, as I downloaded it (before sending the "corpus" search request.):
<form name="qkSrch" method="get" target="_top" action="/science" style="margin:0px;">
<input type="hidden" name="_ob" value="QuickSearchURL">
<input type="hidden" name="_method" value="submitForm">
<input type="hidden" name="_acct" value="C000228598">
<input type="hidden" name="_origin" value="home">
<input type="hidden" name="_zone" value="qSearch">
<input type="hidden" name="md5" value="61ce8901b141d527683913a240486ac4">
<table border="0" width="100%" cellpadding="0" cellspacing="0" style="margin: 0;">
<tbody><tr valign="middle">
<!-- Code related for toggling labels -->
<td align="right"><label for="qs_all" id="fieldLabel"> All fields</label></td>
<td align="left"><input class="textbox qsinput xpstyle" type="text" name="qs_all" id="qs_all" value="" size="30" maxlength="450" title="For example: heart attack AND behavior?" tabindex="1"></td>
<td align="right"><label for="qs_author"> Author</label></td>
<td align="left" colspan="5"><input class="textbox qsinput xpstyle" type="text" name="qs_author" id="qs_author" value="" size="33" maxlength="450" title="e.g. J S Smith or John Smith or Smith JS" tabindex="2" style="_width:100%"></td>
<td nowrap="nowrap">
</td><td></td><td></td>
<td align="right" nowrap="nowrap" width="90%" valign="middle">
Advanced search
</td>
</tr>
<tr>
<td align="right"><label for="qs_title"> Journal/Book title</label></td>
<td align="left"><input class="textbox qsinput xpstyle" type="text" id="qs_title" name="qs_title" value="" size="30" maxlength="450" title="For example: journal of molecular biology" tabindex="3"></td>
<td align="right" class="toggleQukSrch2"><label for="qs_vol" id="volField"> Volume</label></td>
<td align="left" class="toggleQukSrch"><input class="textbox qsinput xpstyle" type="text" name="qs_vol" id="qs_vol" value="" size="3" maxlength="10" style="width:30px;" tabindex="4"></td>
<td align="right" class="toggleQukSrch2"><label for="qs_issue" id="issueField"> Issue</label></td>
<td align="left" class="toggleQukSrch"><input class="textbox qsinput xpstyle" type="text" name="qs_issue" id="qs_issue" value="" size="3" maxlength="10" style="width:30px" tabindex="5"></td>
<td align="right" class="toggleQukSrch2"><label for="qs_pages" id="pageField"> Page</label></td>
<td align="right" class="toggleQukSrch"><input class="textbox qsinput xpstyle" type="text" name="qs_pages" id="qs_pages" value="" size="3" maxlength="10" title="For example: 14-27" style="width:30px" tabindex="6"></td>
<td align="right" nowrap="nowrap">
<input class="button" id="submit_search" type="Submit" alt="Submit Quick Search" title="Submit Quick Search" value="Search ScienceDirect" tabindex="8" name="sdSearch">
</td>
<td align="right" nowrap="nowrap" colspan="8" valign="bottom">
<a class="icon_qmarkHelpsci_dir" href="/science?_ob=HelpURL&_file=qs_tips.htm&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=2bd779305b31602341744eaa786e2f0a" target="sdhelp" onmouseover="window.status='Help is Available';return true" onmouseout="window.status='';return true" onclick="var helpWin;helpWin=window.open('/science?_ob=HelpURL&_file=qs_tips.htm&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=2bd779305b31602341744eaa786e2f0a','sdhelp','scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,status=no,width=760,height=570');helpWin.focus();return false" tabindex="9" style="font-size:0.92em;padding-right:0;">Search tips</a>
</td>
</tr>
</tbody></table>
</form>
EDIT
Continued with How to extract the number of results from the results page.
Your assumption is right, you'll have to change other parts of the code, namely that extracts the number of results value.
Let's stick with the previous example.
When searching from "corpus", you will find this line in the source of the result page:
<input type="hidden" name="TOTAL_PAGES" value="2836">
And you'll want to extract 2836. Hence you will search for something like <input type="hidden" name="TOTAL_PAGES" value=" and get the subequent value before the closing quote.
I am not going to tell you how to code in VBA, but it is basic String manipulation so I hope you can handle it.

Resources