You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex Jacoby <ae...@isr.umich.edu> on 2008/01/16 16:22:41 UTC

using SubmitLink button without a form

I would like to use a SubmitLink button without a form, but it looks  
like the code for form-less SubmitLink only handles the case when it's  
attached to an anchor tag, and not when it's attached to a button input.

 From SubmitLink.java:
// Here it properly sets the href tag in the case of an anchor, and  
calls getTriggerJavaScript for other cases...
	protected void onComponentTag(ComponentTag tag)
	{
		// [snip]
			if (tag.getName().equalsIgnoreCase("a"))
			{
				tag.put("href", "#");
			}
			tag.put("onclick", getTriggerJavaScript());
		}
	}

// ... but getTriggerJavaScript returns null if there's no form
	protected final String getTriggerJavaScript()
	{
		if (getForm() != null)
		{
			// [Does a lot of stuff]
		}
		else
		{
			return null;
		}
	}

I'm not sure what the javascript should be, but it should be possible,  
right?

Thanks,
Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: using SubmitLink button without a form

Posted by Alex Jacoby <ae...@isr.umich.edu>.
Solved: Just using a normal Link with its onClick instead.  No need  
for onSubmit.

Still, should the SubmitLink be fixed or have its javadocs updated, or  
am I missing something?

Thanks,
Alex

On Jan 16, 2008, at 10:22 AM, Alex Jacoby wrote:

> I would like to use a SubmitLink button without a form, but it looks  
> like the code for form-less SubmitLink only handles the case when  
> it's attached to an anchor tag, and not when it's attached to a  
> button input.
>
> From SubmitLink.java:
> // Here it properly sets the href tag in the case of an anchor, and  
> calls getTriggerJavaScript for other cases...
> 	protected void onComponentTag(ComponentTag tag)
> 	{
> 		// [snip]
> 			if (tag.getName().equalsIgnoreCase("a"))
> 			{
> 				tag.put("href", "#");
> 			}
> 			tag.put("onclick", getTriggerJavaScript());
> 		}
> 	}
>
> // ... but getTriggerJavaScript returns null if there's no form
> 	protected final String getTriggerJavaScript()
> 	{
> 		if (getForm() != null)
> 		{
> 			// [Does a lot of stuff]
> 		}
> 		else
> 		{
> 			return null;
> 		}
> 	}
>
> I'm not sure what the javascript should be, but it should be  
> possible, right?
>
> Thanks,
> Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org