Discussion:
Form with just checkboxes does not allow to switch all off?!?
Ondřej Čada
2013-01-18 03:01:46 UTC
Permalink
Hello there,

I've got this kind of form:

<wo:form action = "$app.emptyAction">
Check
<wo:checkbox checked = "$auctionTemplate.hiddenForOwner" onchange = "this.form.submit();" /> hidden for owner
<wo:checkbox checked = "$auctionTemplate.hiddenForBroker" onchange = "this.form.submit();" /> hidden for broker
</wo:form>

where app.emptyAction is truly an empty action (no contents, returns null), and it works excellently -- unless the last of the switches (regardless which one) is to be switched off.

In that case, the form properly reloads, but auctionTemplate is _not_ changed at all -- the application is _not_ informed about the change, and the hiddenForXXX property stays on.

Just by chance, I've found that if I add a completely unused variable 'wtf' to the component and change the form thus:

<wo:form action = "$app.emptyAction"> ### action which does nothing at all
Check
<wo:checkbox checked = "$auctionTemplate.hiddenForOwner" onchange = "this.form.submit();" /> hidden for owner
<wo:checkbox checked = "$auctionTemplate.hiddenForBroker" onchange = "this.form.submit();" /> hidden for broker
<wo:hidden value = "$wtf"/>
</wo:form>

it works quite all right.

What the heck?!? Is that a known bug in HTML or WebObjects or...what? Or is there some weird problem in my code somewhere?

Thanks and all the best,
---
Ondra Čada
OCSoftware: ***@ocs.cz http://www.ocs.cz
private ***@ocs.cz http://www.ocs.cz/oc
Chuck Hill
2013-01-18 03:13:44 UTC
Permalink
That is an old HTML feature. A form containing all unckecked checkboxes submits nothing. You are not the first to have been bitten!

Chuck
Post by Ondřej Čada
Hello there,
<wo:form action = "$app.emptyAction">
Check
<wo:checkbox checked = "$auctionTemplate.hiddenForOwner" onchange = "this.form.submit();" /> hidden for owner
<wo:checkbox checked = "$auctionTemplate.hiddenForBroker" onchange = "this.form.submit();" /> hidden for broker
</wo:form>
where app.emptyAction is truly an empty action (no contents, returns null), and it works excellently -- unless the last of the switches (regardless which one) is to be switched off.
In that case, the form properly reloads, but auctionTemplate is _not_ changed at all -- the application is _not_ informed about the change, and the hiddenForXXX property stays on.
<wo:form action = "$app.emptyAction"> ### action which does nothing at all
Check
<wo:checkbox checked = "$auctionTemplate.hiddenForOwner" onchange = "this.form.submit();" /> hidden for owner
<wo:checkbox checked = "$auctionTemplate.hiddenForBroker" onchange = "this.form.submit();" /> hidden for broker
<wo:hidden value = "$wtf"/>
</wo:form>
it works quite all right.
What the heck?!? Is that a known bug in HTML or WebObjects or...what? Or is there some weird problem in my code somewhere?
Thanks and all the best,
---
Ondra Čada
_______________________________________________
WebObjects-dev mailing list
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
p***@mac.com
2013-01-18 03:25:27 UTC
Permalink
You have to include a hidden element.

David
Post by Chuck Hill
That is an old HTML feature. A form containing all unckecked checkboxes submits nothing. You are not the first to have been bitten!
Chuck
Post by Ondřej Čada
Hello there,
<wo:form action = "$app.emptyAction">
Check
<wo:checkbox checked = "$auctionTemplate.hiddenForOwner" onchange = "this.form.submit();" /> hidden for owner
<wo:checkbox checked = "$auctionTemplate.hiddenForBroker" onchange = "this.form.submit();" /> hidden for broker
</wo:form>
where app.emptyAction is truly an empty action (no contents, returns null), and it works excellently -- unless the last of the switches (regardless which one) is to be switched off.
In that case, the form properly reloads, but auctionTemplate is _not_ changed at all -- the application is _not_ informed about the change, and the hiddenForXXX property stays on.
<wo:form action = "$app.emptyAction"> ### action which does nothing at all
Check
<wo:checkbox checked = "$auctionTemplate.hiddenForOwner" onchange = "this.form.submit();" /> hidden for owner
<wo:checkbox checked = "$auctionTemplate.hiddenForBroker" onchange = "this.form.submit();" /> hidden for broker
<wo:hidden value = "$wtf"/>
</wo:form>
it works quite all right.
What the heck?!? Is that a known bug in HTML or WebObjects or...what? Or is there some weird problem in my code somewhere?
Thanks and all the best,
---
Ondra Čada
_______________________________________________
WebObjects-dev mailing list
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
_______________________________________________
WebObjects-dev mailing list
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
Continue reading on narkive:
Loading...