How do I access an error if I use ngf-select with only single file support and the element not on a form? - ng-file-upload

Here is the HTML code example
<div class="button" ngf-select="upload($file)" ng-model="file" name="file"
ngf-pattern="'image/*'" ngf-accept="'image/*'"
ngf-max-size="20MB" ngf-min-height="100"
ngf-resize="{width: 100, height: 100}">
Select
</div>
Any ideas?

Related

How do you extend templates in Leaf using the #extend and #export tags in leaf?

The Leaf documentation doesn't seem to be working for me I can't figure out why.
child.leaf
#extend("index"):
#export("hello"):
<p>Welcome to Vapor!</p>
#endexport
#endextend
index.leaf
<!-- Backend Projects -->
<div class="seciton-label">
<h3>#(.backendCollection.title)</h3>
</div>
#import("hello")
<!-- Backend Card -->
#for(card in .backendCollection.collection):
<div class="greeting-card">
<a href=#(card.url)>
<h3>#(card.title)</h3>
</a>
<p> #(card.description) </p>
</div>
#endfor
The following image is the result I get in localhost
Request result running the vapor server on localhost
Please help - I can't find solutions to this issue.
No response from forums.swift.org
Tried removing the import key
Removing quotes
I saw individuals using the following format in older versions of Vapor. This did not work for me either.
<!-- I tried the following format for the extend and export blocks -->
#extend("index") {
#export("hello") {
<p>Welcome to Vapor!</p>
}
}
I'm trying to be able to extend the leaf templates and understand why the html does not render.
This works and does something similar to what you want.
This is my 'template' (heavily simplified here), called Base.leaf:
<!DOCTYPE html>
<html>
<head>
<title>#(title)</title>
</head>
<body>
#import("body")
</body>
</html>
#extend("Build/Message")
</body>
</html>
The extend of Build/Message above behaves simply like an include.
Then I use it in a form called Login.leaf here:
#extend("Build/Base"):
#export("body"):
<form method="POST" action="/log-in">
<label for="email">Email</label>
<input type="text" name="email" required>
<label for="password">Password</label>
<input type="password" name="password" required>
<button class="btn-success">Log-in</button>
</form>
#endexport
#endextend
I then use the `Login.leaf' in a render such as:
let context = ["title": "Log in", "version": C.Msg.Version, "message": request.getMessage()]
return try await request.view.render("Form/Login", context)

Classic ASP code inside HTML Form TextArea input return as text from Access database

I want to insert with form TextArea input HTML with ASP code to Access 2000 database.
This is OK, but when retrieve the recordset from an ASP page, the part of ASP code is just text. What I'm doing wrong?
What I have tried:
The Insert Code:
<%
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_conn_STRING
MM_editCmd.CommandText = "INSERT INTO KioskLayout (KioskHtml) VALUES (?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 203, 1, 536870910, Request.Form("KioskLayHtml")) ' adLongVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
%>
The HTML Form Code:
<form METHOD="POST" name="Layout" action="<%=MM_editAction%>" class="center">
<textarea class="form-control" id="KioskLayHtml" name="KioskLayHtml">
<!--This is The TextArea field Input -->
<div class="grid-container">
<div class="main"><%=rs("today")%></div>
<div class="Left"><%=rs("tomorrow")%></div>
<div class="Bottom"><%=rs("yesterday")%></div>
</div>
<!--End Of TextArea field Input -->
</textarea>
<input type="hidden" name="MM_insert" value="Layout">
<input type="submit" name="button" id="button" value="Submit">
</form>
But when retrieve the recordset from an ASP page shows this as text.
<%=rs("today")%>
<%=rs("tomorrow")%>
<%=rs("yesterday")%>
and view the page source shows this:
<div class="grid-container">
<div class="main"><%=rs("today")%></div>
<div class="Left"><%=rs("tomorrow")%></div>
<div class="Bottom"><%=rs("yesterday")%></div>
</div>
Any help?
IS the file saved as .ASP ? It appears to be pure HTML in which case what's between brackets won't be parsed on the server.

scala type of forms

i'm new to scala language . what i wanted to know is i need to select a value from a drop down.what happens here is drop down as below.
<input id="categoryDid" class=" x-form-text x-form-field print_underline x-form-empty-field x-trigger-noedit" type="text" name="category" autocomplete="off" size="24" tabindex="1" readonly="" style="width: 132px;"> drop down data some where else. <div id="ext-gen274" class="x-combo-list-inner" style="width: 148px; margin-bottom: 8px; height: 63px;">
drop down data some where else as below.
<div id="ext-gen274" class="x-combo-list-inner" style="width: 148px; margin-bottom: 8px; height: 63px;">
<div class="x-combo-list-item">--Select--</div>
<div class="x-combo-list-item">Mobile Phone</div>
<div class="x-combo-list-item x-combo-selected">Tablet</div>
</div>
i'm using gatling / scala combination .now what i need to select is "Mobile Phone". i used formParam("categoryDid", "Mobile Phone") but seems this is not working.
can some one help ?
The NAME of your parameter (see input field) is category, not categoryDid:
formParam("category", "Mobile Phone")

How to parse an <img> that is deep within a div using Element Parser?

I'm currently using an parser called Element Parser and I'm trying to parse an img tag that is the 4th img tag down under the div id "Group-E". I can retrieve the 2nd img but not anything after the 2nd img. The img that I'm wanting to parse is:
<img src="http://example.com/I_need_this_image_here.jpg" />.
How can this be done? So far I've used the following code to get the 1st img tag:
Element* needIMG = [document selectElement: #"div.edgeTop div#Group-E img"];
HTML Code trying to parse
<div class="edgeTop">
<div id="Group-E">
<img src="http://example.com/image.jpg" id="image" /> <img src="http://example.com/image2.png" border="5" />
<h4>Group - Section E</h4>
<div class="efs" style="width:28px;">Group:</div>E<br />
<div class="efs" style="width:28px;">Link:</div>Group E<br />
<div class="efs" style="width:28px;">Date:</div><strong>Febuary 15, 2001</strong> by <strong>Date</strong><br />
<br />
<img src="http://example.com/image3.gif" class="image" style="padding: 0 4px 7px 0;" />Group;. <b>Group E</b><br /><br />Group E Other:
<img src="http://example.com/I_need_this_image_here.jpg" /> Other:<br />Group Site
<div class="efs">
<div style="padding:18px 0 1px 8px;">Link Pics:</div>
<img src="http://example.com/linkpic.gif" class="imagelink"/> </div>
</div>
<div class="efsl"></div>
Thanks for the help.
Figured it out after hours of trial and error. You have to use the "+" selector to get the next element.
Could you not add a class to the image you want to parse such as...
<img class="imgtoparse" src="http://example.com/I_need_this_image_here.jpg" />

One click to trigger several search forms?

I have 1 main search form with a submit button and several secondary search forms with submit buttons.
What I would like to do is when I enter text and click on the submit button of the main search form, the same text gets copied in all of the secondary search forms and all the submit buttons of the secondary search forms get automatically hit.
The HTML code for the mains earch form is shown below:
<form action="query.php" method="get">
Search: <input type="text" name="item" size="30">
<input type="submit" value="send">
</form>
One of the several secondary search forms is shown below:
<FORM action="http://www.dpbolvw.net/interactive" method="GET" target="_blank">
<div style="float: left; padding: 0 3px 0 0;">
<INPUT type="text" name="src" size="9"
value="<?php
$input = $_GET['item'];
echo $input;?>" style="width: 110px; height: 22px;margin:0; padding: 0; font-size:140%;">
</div>
<div style="float: left; padding: 0 3px 0 0;">
<input type="image" name="submit" value="GO" src="http://images.guitarcenter.com/Content/GC/banner/go.gif"
alt="Search" style="font-size:140%">
/div>
<input type="hidden" name="aid" value="1234"/>
<input type="hidden" name="pid" value="1234"/>
<input type="hidden" name="url" value="http://www.guitarcenter.com/Search/Default.aspx"/>
</form>
Notice the php code that I put in the "value" field of the secondary search form:
<?php
$input = $_GET['item'];
echo $input;?>
This automatically copies the text that I entered in the main search form into the secondary search form. I thus figured out how to do that.
The problem is to "simulate" an "Enter" keystroke or a click on the "GO" button with the mouse on the secondary search form when the user hits the Enter key or hits the "SEND" button with the mouse on the main search form.
Thank you for your insight!
I'm not sure what the point of that would be, It looks like all of these are search forms all pointing to different sites. Web browsers won't allow that. They can navigate to one page at a time. When you post a form to a page you are navigating to that page. Therefore, you are trying to navigate to several pages at once. It's like trying to be in Paris and London at the same time. I don't see how your plan will work the way you're describing it.
That said, You can use client-side javascript to call
document.forms[0].submit();
so if you can come up with a plan that does not involve trying to have the user see all the different search results in one window, you could try this on your first form...
<form action="query.php" method="get" onSubmit="document.forms(1).Submit();">
You should use AJAX (JQuery) as Brandon Suggested. Read http://docs.jquery.com/Events/submit
Example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("#submit").click(function() {
//Do you stuff here like triggering other submits
//Like:
$("input#submit2").click();
$("input#submit3").click();
return false;
});
});
</script>
</head>
<body>
<form action="javascript:alert('success!');">
<div>
<input type="text" />
<input type="submit" id="submit" />
</div>
</form>
<form >
<div>
<input type="text" />
<input type="submit" id="submit2" />
</div>
</form>
<form >
<div>
<input type="text" />
<input type="submit" id="submit3" />
</div>
</form>
</body>
</html>
Take a look at the submit() event in jQuery. That is going to be your key.
I am assuming that you are planning on submitting via ajax? Otherwise it is futile.
So you could do something like this-
Give all of your forms a certain class, let's call it 'ajax_search_forms'. So now you can actually hook into the submit event.
$('.ajax_search_forms').submit(function(){
var search_string = $('input[name=src]').val();
$('.ajax_search_forms').each(function(){
$.ajax({
url : $(this).attr('action'),
data : 'search_string=' + search_string,
success : function(html){
// Do something with the result
}
});
});
// Return false is VERY important so that the form submission does not continue
return false;
});