I am trying to submit a form after updated all the fields but the amount field keep changing back to zero no matter what amount updated. Below is the element of that particular field:
input id="$PAcqCaseCreation$pTransactionAmount" onchange="onAmountChange(this,
document.getElementById('TranNOD').value ,
document.getElementById('TranDecimalSymbol').value,
document.getElementById('TranDecimalSymbolForLocale').value,
document.getElementById('TranThousandsSep').value , 'false' ); "
class="rightJustifyStyle" type="text" size="10"
value="" data-changed="false"
My code:
doc.getElementsByTagName("iframe")(0).contentDocument.getElementsById( _
"$PAcqCaseCreation$pTransactionAmount").innerText = fileLink9
Related
The image above represents a project I'm working on. Of the 3 fields, only purchase price data is manually entered. I use the following markup and TS code to set the Outstanding mortgage field to a percentage of the previously provided figure:
<input type="number" class="form-control" min='0' id="purchaseValueInput" formControlName="purchase_value" (ngModelChange)='setPercentages()'>
...
setPercentages() {
this.mortgage = this.analysisForm.value.market.purchase_value * 0.75;
}
My challenge is I need to do a similar thing for the mortgage payments field but as a percentage of the outstanding mortgage value. Because that value is not manually provided the ngModelChange strategy is not working.
How can I resolve that last step?
Update
In my setPercentages() function, I have attempted to set a variable for mortgage payments but I get the following error:
The specified value "NaN" cannot be parsed, or is out of range.
I suspect it's because the field is regarded as empty even though visually it has data in it. I used the following code:
setPercentages() {
this.mortgage = this.analysisForm.value.market.purchase_value * 0.75;
this.mortgagePayments = (this.analysisForm.value.market.outstanding_mortgage * 0.03) / 12;
}
<input type="number" class="form-control" min='0' id="mortgagePaymentValueInput" formControlName="mortgage_payments" [value]="mortgagePayments">
You could try to bind the mortgage payments to a member variable and in the setPercentages function of the other input, you also update the model via that variable.
If ngModelChange doesn't work for some reason you can try to set the value attribute of that input:
<input type="text" value="$300"></input>
I was assigning my percentage values to variables and interpolation to assign the variable as the value of my input field. That proved to the the wrong approach.
What does work is using form patchValue as shown below:
this.analysisForm.patchValue({
market: {
outstanding_mortgage: this.analysisForm.value.market.purchase_value * 0.75,
}
});
I have some links in my database that have area target in then using hashtag #. Example: www.mydomain.com/help/#howcanifixthis
When passing TXTurl www.mydomain.com/help/#howcanifixthis in a link and using Get in the form to input variable only www.mydomain.com/help/ shows up in the form. The hashtag and the area name is missing.
I have tried using htmlentities($TXTurl) and urlencode($TXTurl), and still no luck.
Here is the link the php where I am trying to pass the variable with the hashtag in it.
if($stmt->rowCount() > 0){
while($row = $stmt->fetch()){
echo "<p>" . $row["TXTlinkname"] . "</p>";
}
This is how I am inserting the links with hashtags into my database.
$sql = "INSERT IGNORE INTO TABLENAME (TXTlinkname, TXTurl)
VALUES ('$TXTlinkname', '$TXTurl')";
Here is the input fields that I am passing variables to...
<input type="text" name="TXTlinkname" value="' . htmlspecialchars($_GET["TXTlinkname"]) . '" id="TXTlinkname" class="form-control" placeholder="Type in Hyperlink Name Here..." autocomplete="off">
<input type="url" name="TXTurl" value="' . htmlspecialchars($_GET["TXTurl"]) . '" class="form-control" placeholder="Enter in the URL" autocomplete="on">
I want to be able to pass the URL variable in a link with the hashtag to the form. All My links in my database are to different URL's with the hashtag at the end of the link.
Anything past the # is not sent to he server, you can use GET variables though.
I have a problem with p:selectOneMenus that are in a column of a p:treeTable.
<p:treeTable id="configTree" value="#{catalogBean.root}" var="element"
expanded="true">
The currently selected value is stored in a hashMap. After selecting a value in the selectOneMenu the hashMap is correct. When I refresh the page the hashMap is still correct but the selectOneMenu displays the default (first) value and not the value of the hashMap entry.
<p:selectOneMenu rendered="#{catalogBean.hasNoLeaves(element) and catalogBean.isZeroOne(element) and element.isActivated}"
value="#{configurationBean.map[element]}" effect="fold" style="min-width:200px;" valueChangeListener="#{configurationBean.processValueChange}" immediate="true">
<f:selectItem itemLabel="keine Auswahl" itemValue="" />
<f:selectItems value="#{catalogBean.getCharacteristics(element)}" var="aus"
itemLabel="#{aus.characteristic}" itemValue="#{aus}}"/>
<f:ajax render="#form"/>
</p:selectOneMenu>
The hashMap:
private Map<AbstractProductStructureElement, List<AbstractProductStructureElement>> map = new HashMap<AbstractProductStructureElement, List<AbstractProductStructureElement>>();
Can anyone help me with this problem?
I have a simple search page with this text input form
<form name="assetInput" action="assetResult.jsp" method="get">
<input type="text" name="assetNo" />
<input type="submit" value="Submit" />
</form>
which takes you to a results page that will search an Access database by the Asset Number you type in the search page. The column's data type is number.
This is the code to get the input from the text box, and my attempt to convert the String to an int.
<%
String assetNumber = request.getParameter("assetNo");
int assetNum = Integer.parseInt(assetNumber);
%>
My query:
rs = stmt.executeQuery( "SELECT * FROM [Inventory Tracking] WHERE (([Inventory Tracking].AssetNumber) = '"+assetNum+"')");
I'm able to search columns from the database whose data type is text, but I keep getting errors when trying to search a number column with a String.
Thanks in advance!
Numbers do not take a delimiter, only text fields.
rs = stmt.executeQuery( "SELECT * FROM [Inventory Tracking] WHERE [Inventory Tracking].AssetNumber = "+assetNum);
You could avoid a lot of problems with a parameter.
I'm developing a website for Tenants to find properties. When they sign up, they can choose the property types that they are interested, for example: Apartment or House.
When a Tenant logs into their account, they can then do a search for properties. The search form is prepopulated with the values that they originally entered on sign up, for example: City, Postcode and so on.
The form also needs to display some checkboxes with the relevant boxes ticked for the Property Types that they selected on sign up. I'm having some problems getting this to work and wondered if there is anyone who could correct the code for me?
I believe I need to use an 'IN' statement so that the relevant checkboxes would be ticked, if the IDs for those properties are found in the CustomerReqPropertyType column. The CustomerReqPropertyType column is varchar(50) and as an example, if a user has selected Apartment and House, it is store in the row as 2, 4 (as there is a separate table with the Property Types.
This is the code I have on the page;
<%
While (NOT rspropertytype.EOF)
%>
<li>
<input type="checkbox" name="txtPropertyType" id="txtPropertyType" value="<%=(rspropertytype.Fields.Item("PropertyTypeID").Value)%>"<% If Not rstenantrequirements.EOF Or Not rstenantrequirements.BOF Then %><%If (Not isNull((rstenantrequirements.Fields.Item("CustomerReqPropertyType").Value))) Then If (CStr(rspropertytype.Fields.Item("PropertyTypeID").Value) = CStr((rstenantrequirements.Fields.Item("CustomerReqPropertyType").Value))) Then Response.Write("")%><% End If ' end Not rstenantrequirements.EOF Or NOT rstenantrequirements.BOF %> />
<label for="txtPropertyType"><%=(rspropertytype.Fields.Item("PropertyTypeTitle").Value)%></label>
</li>
<%
rspropertytype.MoveNext()
Wend
If (rspropertytype.CursorType > 0) Then
rspropertytype.MoveFirst
Else
rspropertytype.Requery
End If
%>
I would be very grateful for any help.
In order for a checkbox to be checked the checked property must equal "checked".
e.g.
<input type="checkbox" name="something" value="somethingElse" checked="checked" />
I suspect that in your code the rspropertytype and rstenantrequirements recordsets could be consolidated into one recordset generated from one SQL statement.
e.g.
SELECT pt.*
, CASE
WHEN ISNULL(tr.CustomerReqPropertyType,0) = 0 THEN 0
ELSE 1 END AS [checked]
FROM propertytype AS [pt]
LEFT JOIN tenantrequirements AS [tr]
ON pt.PropertyTypeID = tr.CustomerReqPropertyType
WHERE ...
Then your ASP code could be simplified as well.
e.g.
<%
While (NOT rs.EOF)
Dim pID : pID = rs("PropertyTypeID")
Dim pTitle : pTitle = rs("PropertyTypeTitle")
Dim checked : checked = "" : If (rs("checked") = 1) Then checked = "checked"
%>
<li>
<input type="checkbox" name="txtPropertyType" id="txtPropertyType<%=pID%>" value="<%=pID%>" checked="<%=checked%>" />
<label for="txtPropertyType<%=pID%>"><%=pTitle%></label>
</li>
<%
rs.MoveNext()
Wend
%>
This is really hard to follow. First I'd break up that line to where your while is you can just set a variable and print that to page. I assume you're trying to set the checkbox checked. What I would do is make sure the value returned isn't null assuming this is a query that just returns the property type and you left joined it with the table that has the descriptions in it when they are set for the property in question. I don't see you ever print checked to the checkbox so it's never going to be checked anyway.