• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Problem to submit form using javascript in struts

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a jsp page



Here is my Admin.js



when the aboue jsp is submitted it goes to the saveStatusSetup() in Admin.js, In this saveStatusSetup function is not accepted morethan two spaces in statusName property,It works fine.

But if i give morethan two spaces control will come to this function and then goes focus to the statusName property then immediatly form is submitted ,

How to stop this submission when i give morethan two spaces in statusName property

Help me,

Thanks in advance
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First I think this is not really a struts question. Second, your form is not being submitted. On the button click your calling the javascript function which returns false string which is ultimately being written as the output.

You must write as below


You may want to change the cursor style on mouseover to the image.
[ August 11, 2006: Message edited by: Purushothaman Thambu ]
 
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm re-opening this discussion, as I got stuck in something very similar. I see the code snippet here shows an attribute 'name' for the <html:form/> tag. But I checked the tag details, and there doesn't seem to be an attribute called name.
Struts Tags - form
My actual problem is this. I have a jsp page that I am submitting using an <html:button/>. On clicking the button, a javascript function gets called, which checks for empty fields. If there are any empty fields, it gives an alert. This part works fine. But when there are no empty fields, I have written a

This function is not working. The form doesn't get submitted.
Can anyone please point out my mistake here?

doesn't seem to be working, because using a name attribute in the form element gives me an error.
 
Ranch Hand
Posts: 94
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using jQuery then you can probably do as following code
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got this. It can be achieved by document.forms[0].submit()
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic