Forum

Accueil » Liferay Portal » English » 3. Development

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
l ll
<aui:input type=checkbox
19 décembre 2011 00:14
Réponse

l ll

Rang: Junior Member

Publications: 71

Date d'inscription: 12 décembre 2011

Publications Récentes

1
2<aui:input name="check" label="1" type="checkbox" value="1"></aui:input>
3<aui:input name="check" label="2" type="checkbox" value="2"></aui:input>


The form sends both parameters, regardless of which fields are marked. What is wrong?

1
2int[] selectedColours = ParamUtil.getIntegerValues(actionRequest, "check");
3        for (int wer : selectedColours){
4            System.out.println(wer);
5        }


1
21
32
Mayur Patel
RE: <aui:input type=checkbox
19 décembre 2011 01:18
Réponse

Mayur Patel

Rang: Expert

Publications: 340

Date d'inscription: 17 novembre 2010

Publications Récentes

Right now you've provided values into value field that will select check-box by default,Give it as blank if you don't want to select as checked on load of Page.

aui:input is using the value attribute to set the checked flag,

Refer this link to see how its working,
http://www.liferay.com/community/forums/-/message_boards/message/4231543

Regards,
Mayur
l ll
RE: <aui:input type=checkbox
19 décembre 2011 03:29
Réponse

l ll

Rang: Junior Member

Publications: 71

Date d'inscription: 12 décembre 2011

Publications Récentes

Please example?
Atin Agarwal
RE: <aui:input type=checkbox
30 août 2012 01:21
Réponse

Atin Agarwal

Rang: Junior Member

Publications: 78

Date d'inscription: 19 février 2012

Publications Récentes

Actually i have encountered this same problem.
Whenever i tried to check if the checkbox is checked or not it was always showing false even if it was checked.
Like i wrote:
<aui:input name="xyz" type="checkbox" />

And in javascript :

function validateCheckBox() {
var status = document.getElementById("<portlet:namespace />xyz").checked;
alert(status); // to see if it is checked or not
}

It was always displaying false even when i checked it, which is wrong.
After some R&D I came to know that in AUI if the input type type is checkbox then it appends "Checkbox" to the name of the field.
like in my case name of the field i gave was "xyz" but it was making : "xyzCheckbox". It automatically adds this redundant string "Checkbox" at the end of the name you give.

So if we want to let it execute we have to write something like :

function validateCheckBox() {
var status = document.getElementById("<portlet:namespace />xyzCheckbox").checked;
alert(status); // now it will display as per our assumption
}

Regards
Atin Agarwal