Set page element state - radio button - Newbie Question

6 views
Skip to first unread message

iblueeyes

unread,
Jul 2, 2009, 3:34:46 PM7/2/09
to asp-ajaxed
Hello everyone,

i have a small "problem" with ajaxed. I've created a page, made a
custom layout on it and managed to connect it to the MSSQL.

I have a pagePart where I've put the layout of the tab, and code that
connects and writes data from database. Everything is fine, except one
thing... My problem is a radio button that has ajaxed.callback on the
pagePart where the populated data shows and he also is inside the
pagePart. Basically, it's one of a filter radio group buttons for
retreiving male/female or unfiltered names from the database.
Filter buttons are alive, I get the data displaying and all, only when
pagePart is retreived with data i can't set a clicked button from the
radio group so all 3 options are unchecked...

This is what I've tried:
Original code:
<input type="radio" name="rbFilterGender" value="M"
id="rbFilterGender_" onclick="ajaxed.callback('DisplayPseudoNames',
'content', null, null, 'PseudoNames.asp')" />

Altered non-working code:
<input type="radio" name="rbFilterGender" value="M"
id="rbFilterGender_" onclick="ajaxed.callback('DisplayPseudoNames',
'content', null, null, 'PseudoNames.asp')" checked=<%= lib.iif
("rbFilterGender", "checked", "") %> />

Any help would be appriciated, and sorry for my bad english...

Regards,
iblueeyes

mga...@gmail.com

unread,
Jul 3, 2009, 4:31:20 AM7/3/09
to asp-ajaxed
<%= lib.iif("rbFilterGender", "checked", "") %>

is an inline if ... you could read it as
if "rbFilterGender" then
...
end if

in your case it always returns false as you evaluating a string ...
change it to

<%= lib.iif(page.RFHas("rbFilterGender"), "checked", "") %>

be sure that this field is posted .. if you have it in a form with id=frm then it should work fine..

page.RFHas() checks if a given posted field contains a value different than empty string.


On Jul 3, 2009 2:34am, iblueeyes <gluvacev...@gmail.com> wrote:
>
>
> Hello everyone,
>
>
>
> i have a small "problem" with ajaxed. I've created a page, made a
>
> custom layout on it and managed to connect it to the MSSQL.
>
>
>
> I have a pagePart where I've put the layout of the tab, and code that
>
> connects and writes data from database. Everything is fine, except one
>
> thing... My problem is a radio button that has ajaxed.callback on the
>
> pagePart where the populated data shows and he also is inside the
>
> pagePart. Basically, it's one of a filter radio group buttons for
>
> retreiving male/female or unfiltered names from the database.
>
> Filter buttons are alive, I get the data displaying and all, only when
>
> pagePart is retreived with data i can't set a clicked button from the
>
> radio group so all 3 options are unchecked...
>
>
>
> This is what I've tried:
>
> Original code:
>
>
> id="rbFilterGender_" onclick="ajaxed.callback('DisplayPseudoNames',
>
> 'content', null, null, 'PseudoNames.asp')" />
>
>
>
> Altered non-working code:
>
>
> id="rbFilterGender_" onclick="ajaxed.callback('DisplayPseudoNames',
>
> 'content', null, null, 'PseudoNames.asp')" checked=

iblueeyes

unread,
Jul 3, 2009, 10:57:42 AM7/3/09
to asp-ajaxed
Thanks for quick reply... I managed to figure out what was wrong...

If anyone else comes to same problem this is what happened:

Since it's radio button group, before closing tag of the button i've
just added this:
<%= lib.iif(page.RFT("rbFilterGender")="F", "checked", "")%>

If I put the property checked in the whole picture:
<input type="radio" name="rbFilterGender" value="M"
id="rbFilterGender_" onclick="ajaxed.callback('DisplayPseudoNames',
'content', null, null, 'PseudoNames.asp')" checked="<%= lib.iif
(page.RFT("rbFilterGender")="F", "checked", "")%>" />

the last button in the group will allways be selected, and it's
annoying. So basically all I've done was eliminating the checked=" "
property from the button html code...

Thanks for the help.

Regards,
iblueeyes

On Jul 3, 10:31 am, mga...@gmail.com wrote:
> <%= lib.iif("rbFilterGender", "checked", "") %>
>
> is an inline if ... you could read it as
> if "rbFilterGender" then
> ...
> end if
>
> in your case it always returns false as you evaluating a string ...
> change it to
>
> <%= lib.iif(page.RFHas("rbFilterGender"), "checked", "") %>
>
> be sure that this field is posted .. if you have it in a form with id=frm  
> then it should work fine..
>
> page.RFHas() checks if a given posted field contains a value different than  
> empty string.
>
Reply all
Reply to author
Forward
0 new messages