Simple Dom HTML changes not taken - element

I use simple_html_dom.php
I want to remove the first child of a element :
The HTML :
<div id="result">
<a class="result_type1" href="#">The title</a>
<span class="item">item</span>
<span class="more">more</span>
<span class="description">description</span>
</div>
The PHP test 1 :
foreach($html2->find("div[id=result]") as $element)
{
$element->children(0)->outertext=$element->children(1)->outertext;
$element->children(1)->outertext=$element->children(2)->outertext;
$element->children(2)->outertext=$element->children(3)->outertext;
$element->children(3)->outertext="";
echo $element->children(0)->plaintext;
}
Result (not good) :
The title
PHP test 2
foreach($html2->find("div[id=result]") as $element)
{
$element->children(0)->outertext=$element->children(1)->outertext;
$element->children(1)->outertext=$element->children(2)->outertext;
$element->children(2)->outertext=$element->children(3)->outertext;
$element->children(3)->outertext="";
echo $element->children(0)->outertext;
}
Result (good):
<span class="item">item</span>
And I don't get the same item.
With plaintext, I get the element that should be removed

It appears that these three properties (outertext, innertext and plaintext) are separated when the information is processed, as stored in a multidimensional array:
If you make a change to an element with "outerText", the other two properties do not change:
element1 plaintext: "text 1",
outerText: "<span> text 2 </ span>",
           InnerText: "text 1"
       
Same if you make a change with "plaintext".
element1 plaintext: "text 2"
            outerText: "<div> text 1 </ div>",
         InnerText: "text 1" .
Only the "InnerText" property affects the other two properties ...
element1 plaintext: "text 2"
           outerText: "<div> text 2 </ div>",
          InnerText: "text 2"                  
by against if you change an element with "href" it will affect "outertext" value.
element1 href : "link2",
           outerText: " ",
Inversly change with "outerText" not influence "href".
element1 href : "link1",
           outerText: " ",

Related

vue-the-mask + element ui input slot 2 value error

anyone have the solution for below case ?
<el-input v-model="contactNo" v-mask="'## ### #####'" masked="true" /> // this is valid
I got the error, because v-mask directive requires 1 input, found 2
<el-input placeholder="enter phone number" v-model="contactNo" class="input-with-select">
<el-select v-model="select" slot="prepend" placeholder="select">
<el-option label="restaurant phone" value="1"></el-option>
<el-option label="order phone" value="2"></el-option>
<el-option label="personal phone" value="3"></el-option>
</el-select>
You need to remove apostrophes from v-mask value or bind prop with ::
Option 1:
v-mask="## ### #####"
Option 2:
:v-mask="'## ### #####'"

Contact Form 7 Required field not working

I am using contact form 7 for a number of forms on my site.
I am using almost identical code for two forms.
The problem is, on one form, i am missing 'required field' messages, loading animation on send and the success message.
However, my other forms are working perfectly.
The not working properly form can be found here (just click on any button):
http://trailerbins2u.com.au/
The Code for this form is:
<div class="thrive-col left-col">
[text* your-name placeholder "Name*"][text your-company placeholder "Company"]</div>
<div class="thrive-col right-col">
[email* your-email placeholder "Email*"]
[tel* your-phone placeholder "Phone Number*"]</div>
[text* your-address placeholder "Drop Off Address*"]</div>
[date* your-drop placeholder "Trailer Drop Off Date*"]</div>
[text* your-time placeholder "Preferred Time*"]
[select* your-trailer "Select Trailer Size*" "4 Cubic Metre Lite" "4 Cubic Metre" "5 Cubic Metre" "6 Cubic Metre"]
<div class="thrive-col left-col"><label>Do You Have Household Rubbish?</label>
[checkbox* your-household-rubbish "Household Junk" "Furniture & Furnishings" "Appliances & Whitegoods" "Paper & Stationary" "Office Waste & E-waste" "Rugs & Flooring" "Packaging Waste" "Green Waste" "Mattress" "None of the Above"]</div>
<div class="thrive-col right-col"><label>Do you have Construction Waste?</label>
[checkbox* nl default:10 your-construction-rubbish "Plasterboard (Gyprock)" "Timber & Framing" "Joinery & Cabinets" "Timber Flooring" "Carpet & Underlay" "Packaging Waste" "Builders Rubble" "Kitchen Demolition" "Bathroom Demolition" "None of the Above"]</div>
[textarea your-message placeholder "Your Message"]
[submit "Send"]
My other, perfectly working form can be found here (again, click on any button):
http://trailerbins2u.com.au/rubbish-removal-sydney/
And the code:
<div class="thrive-col left-col">
[text* your-name placeholder "Name*"] [text your-company placeholder "Company"]</div>
<div class="thrive-col right-col">[email* your-email placeholder "Email*"]
[tel* your-phone placeholder "Phone Number*"]</div>
[date* your-drop placeholder "Date Removal Required"]
[text* your-time placeholder "Time*"]
[text* your-address placeholder "Address*"]
<div class="thrive-col left-col"><label>Do You Have Household Rubbish?</label>
[checkbox* your-household-rubbish "Household Junk" "Furniture & Furnishings" "Appliances & Whitegoods" "Rugs & Flooring" "Packaging Waste" "Green Waste" "Mattress" "None of the Above"]</div>
<div class="thrive-col right-col"><label>Do you have Construction Rubbish?</label>
[checkbox* your-construction-rubbish "Plasterboard (Gyprock)" "Timber & Framing" "Joinery & Cabinets" "Timber Flooring" "Carpet & Underlay" "Packaging Waste" "Builders Rubble" "Kitchen Demolition" "Bathroom Demolition" "None of the Above"]</div>
[textarea your-message placeholder "Your Message"]
[submit "Send"]
So as you can see, the code is almost identical. Contact forms 7 is obviously working properly for the second form to send, and no css should be affecting it, as it should affect both.
Any ideas on what's gone wrong?
Thanks Everyone!
It may be due to an extra form tag placed before the short code.

Selecting a field in Protractor

<hs-details-item>
<hs-label>Location</hs-label>
<hs-value-block>
<hs>
<hs-text-box ng-class="{'disabled': isAmenityPosting }" class="required" input-control="{title:'Location', okCallback:setJobSite, value:jobSiteName,
autocomplete:{ values:getJobSiteList, reload: true }, ss:'location'}">
<i class="icon-room"></i><span hs-placeholder="Select Location" class="ng-binding"></span>
</hs-text-box>
</hs>
<hs>
<!-- ngIf: isBarcodeShow() --><hs-button ng-class="{'disabled': soCreating }" class="barcode-special-btn smaller ng-scope" ng-if="isBarcodeShow()" hs-gesture="{handler:startScan, param: onBarcodeScanCompleted}"><i class="icon-br-code"></i></hs-button><!-- end ngIf: isBarcodeShow() -->
</hs>
</hs-value-block>
</hs-details-item>
Scenario: click on “Location” field...
What would be the best way to come up with a command in Protractor to select "location" field from the above Snippet Code?
Can it be done by not using Xpath?
Multiple options here. A sort of a non-welcomed, but short and readable way, would be to use an XPath expression and check the preceding label:
var locationTextBox = element(by.xpath("//hs-label[. = 'Location']/following::hs-text-box"));
locationTextBox.click();

Markdown, Knitr, Pandoc Header block disappears from output when styles sheet is added

---
title: "![logo](../Shared/logo.jpg) Title Text"
author: "Author Name"
output: html_document
css: styles.css
---
This header information gets output with render or knit2html, but when the css: styles.css and associated code
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
require(markdown)
markdownToHTML(inputFile, outputFile, stylesheet='custom.css')
}
)
is added to the start up file, the rendered output file has no header output. The first line in the file is the first line after the last "---" in the *.Rmd file. By the way, "Knit HTML" on the individual *.Rmd content works as expected.
Thanks,
Alan
The option rstudio.markdownToHTML is for R Markdown v1 only. The version based on Pandoc is v2, in which case the css field must be put under the html_document field:
---
title: "![logo](../Shared/logo.jpg) Title Text"
author: "Author Name"
output:
html_document:
css: styles.css
---
Please read the documentation.

How to Insert Record and Upload file using the FreeASPUpload Script

I want to Insert record and upload file at the same time, right now im using FreeASPUpload Script. When i submit the form it returns this error
Cannot use the generic Request collection after calling BinaryRead
Here is the Full Source Code of my page
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
Session.CodePage = 65001
%>
<!-- #include file="UploadClass.asp" -->
<%
Dim uploadsDirVar
uploadsDirVar = server.MapPath("Files_Uploaded")
function OutputForm()
%>
<form name="frmSend" method="POST" enctype="multipart/form-data" accept-charset="utf-8" action="form.asp" onSubmit="return onSubmitForm();">
<input type="hidden" name="ApplicationForm" value="Insert" />
Name: <input type="text" name="name_insert" value="" size="30" />
<B>File names:</B><br>
File 1: <input name="attach1" type="file" size=35><br>
<br>
<input style="margin-top:4" type="submit" value="Submit">
</form>
<%
end function
function TestEnvironment()
Dim fso, fileName, testFile, streamTest
TestEnvironment = ""
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FolderExists(uploadsDirVar) then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not exist.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
fileName = uploadsDirVar & "\test.txt"
on error resume next
Set testFile = fso.CreateTextFile(fileName, true)
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have write permissions.</B><br>The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
exit function
end if
Err.Clear
testFile.Close
fso.DeleteFile(fileName)
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have delete permissions</B>, although it does have write permissions.<br>Change the permissions for IUSR_<I>computername</I> on this folder."
exit function
end if
Err.Clear
Set streamTest = Server.CreateObject("ADODB.Stream")
If Err.Number<>0 then
TestEnvironment = "<B>The ADODB object <I>Stream</I> is not available in your server.</B><br>Check the Requirements page for information about upgrading your ADODB libraries."
exit function
end if
Set streamTest = Nothing
end function
function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function
SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "<B>Files uploaded:</B> "
for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
next
else
SaveFiles = "No file selected for upload or the file name specified in the upload form does not correspond to a valid file in the system."
end if
SaveFiles = SaveFiles & "<br>Enter a number = " & Upload.Form("enter_a_number") & "<br>"
SaveFiles = SaveFiles & "Checkbox values = " & Upload.Form("checkbox_values") & "<br>"
SaveFiles = SaveFiles & "List values = " & Upload.Form("list_values") & "<br>"
SaveFiles = SaveFiles & "Text area = " & Upload.Form("t_area") & "<br>"
end function
%>
<HTML>
<HEAD>
<TITLE>Test Free ASP Upload 2.0</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
BODY {background-color: white;font-family:arial; font-size:12}
</style>
<script>
function onSubmitForm() {
var formDOMObj = document.frmSend;
if (formDOMObj.attach1.value == "")
alert("Please press the Browse button and pick a file.")
else
return true;
return false;
}
</script>
</HEAD>
<BODY>
<br><br>
<div style="border-bottom: #A91905 2px solid;font-size:16">Upload files to your server</div>
<%
Dim diagnostics
if Request.ServerVariables("REQUEST_METHOD") <> "POST" then
diagnostics = TestEnvironment()
if diagnostics<>"" then
response.write "<div style=""margin-left:20; margin-top:30; margin-right:30; margin-bottom:30;"">"
response.write diagnostics
response.write "<p>After you correct this problem, reload the page."
response.write "</div>"
else
response.write "<div style=""margin-left:150"">"
OutputForm()
response.write "</div>"
end if
else
response.write "<div style=""margin-left:150"">"
OutputForm()
response.write SaveFiles()
response.write "<br><br></div>"
end if
%>
</BODY>
</HTML>
<!-- #include file="ADOVBS.inc" -->
<%
'=======================================================================================
' CONNECT DATABASE
'=======================================================================================
Dim objConn, objRs
Set objConn = CreateObject("ADODB.Connection")
Set objRs = CreateObject("ADODB.Recordset")
objConn.open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& server.MapPath("db/Job_database.mdb") &";Mode=ReadWrite|Share Deny None;Persist Security Info=False"
If Request("ApplicationForm") = "Insert" Then
Set InsCom=Server.CreateObject("ADODB.Command")
InsCom.ActiveConnection=objConn
InsName = Trim(request("name_insert"))
InsName = replace(InsName,"'","''")
InsCom.CommandText = "Insert into applications(aname)Values(?)"
InsCom.Parameters.Append InsCom.CreateParameter("#name_insert", adVarChar, adParamInput, 255, InsName)
InsCom.Execute
End If
%>
I have been searching for this problem, but couldn't make it work. although what i found is that i have to use the Form Collection provided by FreeASPUpload. therefore i change
If Request("ApplicationForm") = "Insert" Then
to this
If Upload.Form("ApplicationForm") = "Insert" Then
But it also returns an error, that says: Variable is undefined: 'Upload'
If i change the Request method, it only Uploads the file not inserts the record
If Request.QueryString("ApplicationForm") = "Insert" Then
What i understands is that my insert query is in wrong place or so...
Please help me solve this problem.. thanks
I haven't used AspFreeUpload much so I'm guessing a bit here.
It would appear that using the Request object isn't an option so you're stuck with having to use the Upload.Form. As your code stands, the Upload object is only defined and set within the context of your SaveFiles function.
Try moving your database insert code to within the SaveFiles function. This would mean cutting everything from the line
Dim objConn, objRs
to
InsCom.Execute
and pasting it just before 'End Function'
You may also need to move your include adovbs.inc directive to somewhere before the function was called. The most logical place would be on the line immediately below your other include directive = for uploadclass.asp