Wednesday August 28, 2002
Adding a form element on the fly. I used this code on my project yesterday and thought I'd share.
<script language="text/javascript">
function addActionToForm() {
// get the form to add the input element to
var form = document.getElementById("noteForm");
// Add a action input element
var action = document.createElement("input");
action.setAttribute("type", "hidden");
action.setAttribute("name", "action");
action.setAttribute("id", "action");
action.setAttribute("value", "Save");
form.appendChild(action);
form.submit();
}
</script>
This works great for me when I want to simulate a button named "action" being clicked, but I want to submit the form with JavaScript.
Hmmm, doesn't seem to work in IE5/Mac. Any tips?
Posted in The Web
at Aug 28 2002, 12:03:57 AM MDT
1 Comment
Search This Site
Recent Entries
- Secure JSON Services with Play Scala and SecureSocial
- My What's New in Spring 3.1 Presentation
- Twitter's Open Source Summit: Bootstrap 2.0 Edition
- Refreshing AppFuse's UI with Twitter Bootstrap
- 2011 - A Year in Review
- Upgrading AppFuse to Spring Security 3.1 and Spring 3.1
- What have I been working on at Taleo?
- Our Engaging Trip to Paris and Antwerp
- My HTML5 with Play Scala, CoffeeScript and Jade Presentation from Devoxx 2011
- Deploying Java and Play Framework Apps to the Cloud with James Ward
Hi Matt,
Thanks for the nice explanation. I'm facing the same issue and applied this fix... this helped me partially but, not 100%
My case is: I have a web application which uses form-based authentication. when I deploy it on Jboss node it works great. i.e., when I access any of application resource (jsp) it takes me to login.jsp and when I enter credentials it takes me to main page (on success)
When I deploy this app on JBoss cluster... it is weird. App access takes me to login.jsp but, it don;t take me to main page on login; it is throwing an error (Invalid Login page...) If I refresh the page and re-enter the credentials then, it works fine.
I applied your fix... now, instead of showing me the error, it goes back to 'login.page'... but, as I entered correct credentials it shd take me to main page...
Any clue??
Thanks,
Suresh
Posted by 216.127.129.5 on March 27, 2009 at 01:06 PM MDT #