You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Russell Neufeld <ru...@hds.com> on 2009/04/24 16:22:53 UTC

"disabled" attribute on s:form not working

Hi all,

    I set disabled="true" in an s:form tag, expecting the resulting form 
to be disabled (greyed out, unable to submit by clicking, etc...) 
however that appears not be working.  I checked the HTML that Struts 2 
produced and the "disabled" attribute doesn't show up.  I'm using Struts 
2.1.6.  Any ideas?  Is this a known issue?  Worked fine in Struts 1.

    Thanks,

       Russ

Redirect problem using Ajax and Struts - missing directory for image access

Posted by Qunhuan Mei <qm...@qm18.wanadoo.co.uk>.
Hi there, 

 

My app uses Struts 2.1.6 to handle user’s file upload. It creates a user specific directory, say userDir at rumtime before upload starts. The userDir stores user uploaded files, say an intro.html with images. 

 

The app uses GDownloadUrl (google’s ajax) to access the intro.html in a redirect way, i.e. the GDownload sends a http://serverURL/getIntro.action to the server and server figures out the userDir and redirect to userDir/intro.html, (http://serverURL/userDir/intro.html)

 

The intro.html gets to the browser ok but the images within intro.html, e.g. <img src=”example.jpg”/> does not work. The request for image appears to be http://serverURL/intro.html with userDir always missing.

 

In order to make sure the intor.html and image does work on its own, I have tested:

 

1.       index.html redirect, e.g. to include the following in the index.html file:

<META HTTP-EQUIV="Refresh" CONTENT="0;URL=userDir/intro.html">

It works fine, the image gets rendered.

2.       straight browser action request (e.g. http://serverURL/getIntro.actoin) without using GDownload and then use struts.xml to redirect: 

<result name="success" type="redirect">/userDir/intro.html</result>

This works fine, the image gets rendered.

 

Is there any way this problem could be corrected or avoided? The only option I have is to add userDir to the image reference for intro.html but this is a pain for me. 

 

Could anyone help please?

 

Qunhuan

 


Re: "disabled" attribute on s:form not working

Posted by Dave Newton <ne...@yahoo.com>.
Russell Neufeld wrote:
> Hi Dave,
> 
>    Thanks for the quick response.  Sorry for the incorrect comparison.  
> I'm porting a Struts 1 app to Struts 2, so I've got both frameworks on 
> my mind.
> 
>    Ok, so the "disabled" attribute on the s:form tag doesn't act the 
> same as S1.  That's cool.  Seems like the "disabled" attribute on 
> s:reset and sx:submit don't work though.  I tried
> 
>    <s:reset  value="Reset" class="button" disabled="true"/>
> 
> and this renders a working reset button.  Also, this
> 
>    <sx:submit value="Submit" cssClass="button" id="submit" 
> disabled="true"/>
> 
> renders a working submit button.  That said "disabled" on an s:submit 
> correctly renders an inoperable submit button.  Any ideas what might be 
> going on here?  Thanks,

Looking at the templates I'd say that <s:reset> is missing the "disable" 
attribute, unlike <s:submit>. Please file a JIRA ticket for this; thanks 
for bringing it up.

The same seems to be true for the Dojo submit--it'd be cleaner to submit 
to JIRA tickets since the Dojo stuff is a plugin, but it'd probably be 
okay to lump them into one. Note that the Dojo tags are deprecated, so 
while the fix may make it in, it's unclear how long the plugin will be 
included in the distro (although if it's not in the official distro I'd 
imagine it'll still be available somehow).

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: "disabled" attribute on s:form not working

Posted by Russell Neufeld <ru...@hds.com>.
Hi Dave,

    Thanks for the quick response.  Sorry for the incorrect comparison.  
I'm porting a Struts 1 app to Struts 2, so I've got both frameworks on 
my mind.

    Ok, so the "disabled" attribute on the s:form tag doesn't act the 
same as S1.  That's cool.  Seems like the "disabled" attribute on 
s:reset and sx:submit don't work though.  I tried

    <s:reset  value="Reset" class="button" disabled="true"/>

 and this renders a working reset button.  Also, this

    <sx:submit value="Submit" cssClass="button" id="submit" 
disabled="true"/>

renders a working submit button.  That said "disabled" on an s:submit 
correctly renders an inoperable submit button.  Any ideas what might be 
going on here?  Thanks,

    Russ

Dave Newton wrote:
> Russell Neufeld wrote:
>   
>>    I set disabled="true" in an s:form tag, expecting the resulting form 
>> to be disabled (greyed out, unable to submit by clicking, etc...) 
>> however that appears not be working.  I checked the HTML that Struts 2 
>> produced and the "disabled" attribute doesn't show up.  I'm using Struts 
>> 2.1.6.  Any ideas?  Is this a known issue?  Worked fine in Struts 1.
>>     
>
> Functionality comparisons between S1 and S2 are meaningless; they're 
> completely different frameworks.
>
> According to [1] the form element doesn't have a "disabled" attribute. 
> In S2 the custom tags all(-ish) inherit from a base class that defines a 
> list of supported attributes--this doesn't, however, necessarily imply 
> that the underlying HTML element supports it.
>
> FWIW, a quick sanity-check in FF3 shows no difference if I set a 
> "disabled" attribute on a form element.
>
> Dave
>
> [1] http://www.w3.org/TR/html401/interact/forms.html#h-17.3
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


Re: "disabled" attribute on s:form not working

Posted by Dave Newton <ne...@yahoo.com>.
Russell Neufeld wrote:
>    I set disabled="true" in an s:form tag, expecting the resulting form 
> to be disabled (greyed out, unable to submit by clicking, etc...) 
> however that appears not be working.  I checked the HTML that Struts 2 
> produced and the "disabled" attribute doesn't show up.  I'm using Struts 
> 2.1.6.  Any ideas?  Is this a known issue?  Worked fine in Struts 1.

Functionality comparisons between S1 and S2 are meaningless; they're 
completely different frameworks.

According to [1] the form element doesn't have a "disabled" attribute. 
In S2 the custom tags all(-ish) inherit from a base class that defines a 
list of supported attributes--this doesn't, however, necessarily imply 
that the underlying HTML element supports it.

FWIW, a quick sanity-check in FF3 shows no difference if I set a 
"disabled" attribute on a form element.

Dave

[1] http://www.w3.org/TR/html401/interact/forms.html#h-17.3


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org