How to use the output being returned by a web service in the same HTML page without opening a new page.
The current code I'm using is:
<form action='http://omarelsherif.com/Services/TestXMLWebService/TestService.asmx/HelloWorld3' method="post" target="_blank">
<table align="center" cellpadding="5" width="400" border="1">
<tr>
<td valign="top" width="100">
Hello World 3</td>
<td>
<input class="frmInput" type="text" size="30" name="name" />
<br />
<input class="button" type="submit" value="Submit" />
<br />
<input class="frmOutput" type="text" size="30" name="HelloWorld3" />
</td>
</tr>
</table>
</form>
I want to put the return value in the text box named frmOutput.
If this is asp.net it will need to happen in the codebehind file. You'll need to change (some of) your input fields to asp:controls so you can access in the codebehind. In the code behind for your page you just need to assign the return value from the webservice to you field. Depending on what the webservice returns you might need to do some manipulation on the returned value before you assign it to the output control.
Related
I have this code below from HTML document, result of inspection object from site web.
I want to get the object <input name="username" value=""> with VBA Excel code.
<tr id="username_block">
<td class="shade" width="50%" align="right">
<div align="left">Nom d’utilisateur:</div>
</td>
<td class="shade" width="50%">
<input name="username" value="">
</td>
</tr>
I use this instruction
set element=oIe.Document.getElementsById("username_block")
but no results (element=nothing).
Isn't the method's name getElementById, without "s"?
I am playing with the Spring validating form input example - java spring mvc with Thymeleaf views. I have been able to pass messages into the view without issue. These display where the example wants them to...
e.g.
<td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</td>
I am trying to find a way to put them into the html input validation attributes though so I have tried the following (full page below)
<td><input type="text" th:field="*{age}" **required="required" data-errormessage-value-missing="${#fields.errors('age')}" data-errormessage="${#fields.errors('age')}"**/></td>
This has done no good though and the validation message displayed is ${#fields.errors('age')} ! Is there a way to push the binding errors into the attribute or am I misunderstanding the way it works ?
Thanks for any help in advance.
Page html
<html>
<body>
<form action="#" th:action="#{/}" th:object="${personForm}" method="post">
<table>
<tr>
<td>Name:</td>
<td><input type="text" th:field="*{name}" required="required" data-errormessage-value-missing="Custom Message" /></td>
<td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</td>
</tr>
<tr>
<td>Age:</td>
<td><input type="text" th:field="*{age}" required="required" data-errormessage-value-missing="${#fields.errors('age')}" data-errormessage="${#fields.errors('age')}"/></td>
<td th:if="${#fields.hasErrors('age')}" th:errors="*{age}">Age Error</td>
</tr>
<tr>
<td><button type="submit">Submit</button></td>
</tr>
</table>
</form>
</body>
</html>
Thymeleaf only evaluates attributes that start with th:, so in order to do this, you have to use th:attr. You're tag should look like:
<input type="text" th:field="*{age}" required="required" th:attr="data-errormessage-value-missing=${#fields.errors('age')}, data-errormessage=${#fields.errors('age')}" />
You could also use this plugin to evaluate data tags, but I've haven't used it before so I can't comment on how well it works: https://github.com/mxab/thymeleaf-extras-data-attribute
Using IE, I have a working example code that able show my profile information on XML site included userid, name, company, phone number and etc.
I added HTML codes,
<xml id="XmlUserInfo" src="http://usmdlcdoww002.intranet.dow.com/common/components/userinfo/UserInfoXml.asp?UserID=me"> </xml>
</div>
Number:
</br>
<input datasrc="XmlUserInfo" datafld="cn" type="text" name="Name" size="30" />
XmlUserInfo display a list of information about me. Now I want my name to show up in textbox or whatever in <input> . After I run it, the input box is empty which nothing there. Am I doing it wrong?
Here is XML example display,
<MyData>
<user>
<uid>U580784</uid>
<cn>Frank, Bradley (B)</cn>
<sn>Frank</sn>
<givenName>Bradley</givenName>
<initials>B</initials>
</user>
</MyData>
I found a solution. It required to add table to make this work like this,
<xml id="XmlUserInfo" src="http://usmdlcdoww002.intranet.dow.com/common/components/userinfo/UserInfoXml.asp?UserID=me"> </xml>
</div>
ID:
<br />
Number:
<table datasrc="#XmlUserInfo" border="0">
<tr>
<td>
<input datafld="cn" type="text" name="Name" size="30">
</td>
</tr>
</table>
I read several articles, but couldn't really get things working. Here's what I'm talking about. The Html of a webpage:
<form id="LOGINFORM" name="LOGINFORM" style="margin:0px; padding:0px;" action="login.php" method="post">
<table cellspacing="2" cellpadding="0" border="0" width="100%">
<tr>
<td width="100" align="center" valign="bottom">
Username:
</td>
<td width="100" align="center" valign="bottom">
Pass:
</td>
<td valign="top" align="right">
</td>
</tr>
<tr>
<td align="center">
<input class="inputbox" style="text-align:center; width:90px;" maxlength="12" name="loginname" type="text" size="12">
</td>
<td align="center">
<input class="inputbox" style="text-align:center; width:90px;" maxlength="12" name="password" type="password" size="12">
</td>
<td align="left">
<input
class="button_ok"
name="btnSubmit"
id="btnSubmit"
type="submit"
value="Вход"
onclick=""
>
</td>
</tr>
</table>
</form>
say the webpage is helloworld.com, account is foo, pass is bar.
What I browse: helloworld.com/login.php?loginname=foo&password=bar
But server returns that username/password is wrong, but they aren't. What do I do wrong?
The logic in login.php says that loginname=foo&password=bar is wrong. That is where you need to look to find out why it doesn't work.
As for what is wrong with the HTML.
You are using a table for layout
You aren't using <label> elements to label your inputs
You having given a form a name, these days an id is all that is required (and then only if you need to reference it with JS or CSS)
You are using a style attribute instead of a seperate stylesheet, and quite a few obsolete presentational attributes (such as align, width and cellspacing)
that form secifies that the data is passed via POSt, and not GET as you are trying to pass it. If a form wants data back specifically as POST data, that page will ignore GET data. see this tutorial
Your HTML says method="post", so I guess the server will only accept those values by the POST method. When you browse that URL, you are sending them using the GET method.
You are confusing GET and POST in PHP:
$_GET['loginname'] will retrieve a query string variable.
$_POST['loginname'] will retrieve the value of the input named "loginname". (This is what you need.)
helloworld.com/login.php?loginname=foo&password=bar uses GET
In my jsp code I use the request.getParameter() to retrieve the data which is entered in html. The data was retrieved when using get method but it is not when im using post method
Why this happend
My html form is
<code>
<form name="inp" action="upload.jsp" method="post" onsubmit="return valid();" enctype="multipart/form-data">
<table align="center" cellspacing="2">
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td><font size="5" color="#E41B17">Select File</font> </td>
<td><input type="file" name="infile"></td>
</tr>
<tr><td><font size="5" color="#E41B17">Target File Name</font></td>
<td><input type="text" size="20" name="filename"></input></td>
</tr>
<tr></tr>
<tr><td colspan="2" align="center"><input type=submit value="Upload" ></td></tr>
</table>
<br></br>
<center>
<font color="#E41B17">HOME</font>
</center>
</form>
</code>
And my jsp scriptlet is
<% String f = request.getParameter("filename");
System.out.println(f); %>
Thanks in Advance
Now to the issues: you've set the form's content type to be multipart, which means that you have to explicitly parse the request body; the container will only parse if you leave the default form-encoded. This article seems to give an example of how to access multipart data on the server side.
Aside from that, you do realize that your form is commented-out, so should never be handled by your browser, right? If you're actually seeing something on the browser, it probably isn't coming from this location.