CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2008
    Posts
    41

    Struts- Submitting a form using hyperlink

    Hi, i have a tile with two hyperlinks... I would like to submit another JSP tile (form) with data...

    Code:
    	<a href="javascript: submitqual()">Qualified</a>
    
    	<script type="text/javascript">
    		function submitqual()
    		{
    			document.qualsForm.printQual.value = true;											
    			document.qualsForm.submit();						
    		}
    	</script>
    	<br />
    	<a href="javascript: submitnonqual()">Not Qualified</a>
    
    	<script type="text/javascript">
    		function submitnonqual()
    		{
    			document.qualsForm.printNonQual.value = true;			
    			document.qualsForm.submit();						
    		}
    	</script>
    	<br />
    When i press 'Qualified', the form qualsForm has checkBoxes which i would like to submit to the action class... For some reason this data is not passe through

    here's my FormObject

    Code:
    public class QualsForm  extends ActionForm  implements java.io.Serializable  {
    	
    
    	private boolean printQual;
    	private boolean printNonQual;
    	private String[] checkeJPQuals = null;
    	private String[] checkePPQuals = null;	
    	
    	public QualsForm() {
    	}
    	
    	public String[] getCheckeJPQuals() {
    		return checkeJPQuals;
    	}
    	public void setCheckeJPQuals(String[] checkeJPQuals) {
    		this.checkeJPQuals = checkeJPQuals;
    	}
    	public String[] getCheckePPQuals() {
    		return checkePPQuals;
    	}
    	public void setCheckePPQuals(String[] checkePPQuals) {
    		this.checkePPQuals = checkePPQuals;
    	}
    
    	public boolean isPrintQual() {
    		return printQual;
    	}
    
    	public void setPrintQual(boolean printQual) {
    		this.printQual = printQual;
    	}
    
    	public boolean isPrintNonQual() {
    		return printNonQual;
    	}
    
    	public void setPrintNonQual(boolean printNonQual) {
    		this.printNonQual = printNonQual;
    	}
    }

  2. #2
    Join Date
    Feb 2008
    Posts
    966

    Re: Struts- Submitting a form using hyperlink

    I would think that you should have a javascript error on the page when attempting this.

    document.qualsForm.printQual.value

    Should be:

    document.qualsForm.getElementById("printQual").value

    Or with jquery
    $("#printQual").val(true);

    Are you getting a javascript error (bottom left corner in I.E.) when running this? And can you post the relevant jsp code (where the check boxes are declared)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured