Folks,
I am trying to add a DateTimePicker javascript file in one of the screen. On clicking the calender icon, the calender is not getting poped up.
I added the javascript file in the public/javascript folder and the image in the public/images folder.
Then I added this line in main.html:
<script type="text/javascript" src="#{'/public/javascripts/datetimepicker_css.js'}" ></script>
and this line for diaplsying the image beside the textbox:
<input type="text" styleId="demo1" name="transaction.returnDate" size="10">
<img src="#{'/public/images/cal.gif'}" onclick="javascript:NewCssCal('demo1')" style="cursor:pointer"/>
When the screen is loaded, the image is getting diaplsyed properly beside the textbox. But when I click it, the calendar is not getting displayed.
I use these two lines in my other struts application and it works fine:
<script language="javascript" type="text/javascript" src="/MediaTest/datetimepicker/datetimepicker_css.js">
<html:text styleId="demo1" name="returnForm" property="returnDate" size="10"></html:text>
<img src="/MediaTest/datetimepicker/cal.gif" onclick="javascript:NewCssCal('demo1')" style="cursor:pointer"/>
Please let me know how to make it work.
Thanks,
change styleId attribute to id
<input type="text" id="demo1" name="transaction.returnDate" size="10">
Related
Whenever I click on a button in my HTML side, I'm switching to my JSP-File (localhost:8080/index.hmtl -> localhost:8080/result.jsp). But my intention is to load the JSP script in the background and put the result of the jsp on my HTML side so i still stay on localhost:8080/index.html. Summarized this is a quick overview of my HTML side:
<form action="result.jsp">
Some Input textfield: <input type="text" name="name">
<input type="submit" name="button" value="eintragen">
</form>
So, is there a special command for this or a easy way to solve this problem?
As we know every jsp program there is a servlet behind the jsp page. I have used a jsp page to make a form (its a very small form), and in the same jsp i used scriptlet tags and made a way to get the inserted form data, and display it using out.print(). but the problem is it when i run it, the form is displayed., but when i submit is, it doesn't recognize the servlet page (error coming as "The requested resource is not available"). i will put the code below., please help me friends to solve this problem. thank you.
i did this in netbeans.
jsp page name is- "hello.jsp"
the servlet page name behind the jsp page is: "hello_jsp.java".
<html>
<head><title>IF...ELSE Example</title></head>
<body>
<form action="hello_jsp" method="post">
<input type="text" name="y"/>
<input type="submit" value="submit"/>
<%
if(request.getParameter("y")!=null) {
String s = request.getParameter("y");
if(s.equals("hello")){
out.print("welcome"+s);
}else{
out.print("not welcome");
}}
%>
</form>
</body>
</html>
My guess is that you need to change
<form action="hello_jsp" method="post">
to
<form action="hello.jsp" method="post">
<!-- ^---- change is here -->
The externally-accesible resource is the jsp, not the servlet. (By default, I'm sure some config-fu could change that.)
Or, of course, if the page is supposed to submit to itself, don't include action at all. The default is to submit to the current page.
<form method="post">
In my application, I have got an image as a button. When I record the button click event in Selenium IDE and replay it, i merely plays it back but the click event is not actually submitting the value
Ex: The submit button (which is an image) should actually submit the value to database. But when I check in the database, the value is not added there
Element Value
<input width="98" vspace="3" type="Image" height="15" border="0"
id="Image1" src="images/butt_submit.gif" value="Submit" name="Submit">
Selenium Code
selenium.click("//input[#id='Image1']");
selenium.waitForPageToLoad("30000");
Please assist.
Thanking you!
HG
The issue is not with Selenium/IDE not clicking the image. The code you're using (in HTML) will not submit the form data even if you did it manually. Did you check that first?
Anyway, if you want to use an image as the submit action for a form, add an onclick event for the image to submit the form. See this example on W3Schools for form.submit:
<html>
<head>
<script>
function formSubmit()
{
document.getElementById("frm1").submit();
}
</script>
</head>
<body>
<form id="frm1" action="form_action.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="button" onclick="formSubmit()" value="Submit form">
</form>
</body>
</html>
They are using a button here but you can use that for your image.
More about HTML Forms basics: http://www.w3schools.com/html/html_forms.asp
I'm building a webapp (using java,spring,freemarker and tiles) with tinyMCE editor.
I've added all files to classpath, everything is on the right place, tinyMCE editor is ALMOST correctly loaded...
There are several fields in my form, text inputs, options, buttons, labels etc... but the problem occurs when I run this form. tinyMCE replaces the whole form, not just textarea and puts that form inside itself - into tinyMCE editor area.
I am following basic installation found here http://www.tinymce.com/wiki.php/Installation
My code is almost the same as here, has more elements in form.
Is there any solution for this? Is this a standard behavior?
I run it on FF 13.0.1 if it matters...
my init code in form.ftl file is:
<#import "../spring.ftl" as spring>
<#assign form=JspTaglibs["http://www.springframework.org/tags/form"]>
<html>
<head>
<script type="text/javascript" src="/resources/tinymce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
height : "480",
mode : "textareas"
});
</script>
</head>
<body>
<div id="content">
<#form.form>
<input type="text" id="title"/><br>
<input type="text" id="author"/><br>
<textarea id="content"></textarea><br>
<button type="submit"/> <button type="reset"/>
</#form.form>
</div>
</body>
</html>
Ok
I've found the solution. The problem was that I had two elements with the same id="content", there was
<div id="content">...</div>
and
<textarea id="content"></textarea>
when I changed it to be unique it resolved the problem.
According to another question, you can view your skin with this code:
<applet code="net.minecraft.skintest.ModelPreviewApplet"
archive="http://www.minecraft.net/skin/skintest.jar" codebase="."
width="320" height="320">
<param name="name" value="535" />
</applet>
Which works!
But does anyone knows how i can make a textbox and a button which puts the written text in the value="535" tag (replaces "535" with the text box input)?
Link to the other question: Is there a web-embeddable skin preview application?
You can write your applet into the DOM at run-time like this:
<div id="wrapper"></div>
<input type="text" value="" onchange="writeApp(this.value)">
<input type="button" value="go">
<script type="text/javascript">
function writeApp(pVal) {
document.getElementById('wrapper').innerHTML = '<applet code="net.minecraft.skintest.ModelPreviewApplet" archive="http://www.minecraft.net/skin/skintest.jar" codebase="." width="320" height="320"><param name="name" value="'+pVal+'" /></applet>'
}
</script>
Strangely enough, the applet doen't seem to like values other than "525"
That should be easy, but I don't think it will do what you want it to do.
I'm assuming you want to have a preview window with the texture preview, and allow users to type in new texture IDs, push the button, and see the preview right away.
Simply changing the value of the param after the page has loaded won't accomplish that.
When the button gets pushed, you'll need to remove the applet and re-create it, with the new param value in order for the changes to take effect.
Here's the code you asked for:
<applet
code="net.minecraft.skintest.ModelPreviewApplet"
archive="http://www.minecraft.net/skin/skintest.jar" codebase="."
width="320"
height="320">
<param name="name" id="previewName" value="535" />
</applet>
<input type="text" id="newValue" />
<script>
document.getElementById('newValue').onblur = function(event) {
// grab value
var iVal = parseInt(this.value);
if(!iVal && iVal !== 0) return;
// update param
document.getElementById('previewName').value = iVal;
return true;
};
</script>
If you try that and it doesn't accomplish what you wanted, let me know and I can write the code that will do it.