Re: AjaxObserveField with radioButtons
Re: AjaxObserveField with radioButtons
- Subject: Re: AjaxObserveField with radioButtons
- From: Ralf Schuchardt <email@hidden>
- Date: Thu, 15 Jun 2017 11:30:04 +0200
Hi Pierre,
we do this directly in JavaScript (jQuery) and CSS without Ajax. Some
radiobuttons have a special CSS class and a data-attribute with the id of the
field (or surrounding DIV) to hide. A click handler reads the radiobuttons
value attribute and decides to either hide or display the connected field. As
this is only a display change on the client side, any value in the textfield is
still send on the next normal submit.
--
Ralf Schuchardt
Sent with Airmail
Am 15. Juni 2017 um 10:41:18, GILQUIN Pierre (email@hidden) schrieb:
Hi
I have 2 RadioButton Yes/NO. When Yes is selected a textfield is visible
and a value can be set.
When NO is selected, the texfield is hided using a conditionnal.
Selectionning YES back, the textfield become visible but the value is
lost (null is sent)
I want a way to keep the value even if the textfield was hidden.
It's work with a popup as there only one id and I can use fullSubmit =
false. But with radiobuttons, there are many id and fullSubmit = true
must be used.
With fullSubmit = true, the hidden textfield send a null value ...
Thanks for any idea/workaround ?
Pierre
The html is the following :
<wo:form>
<wo:AjaxUpdateContainer id = "globalContainerId">
<wo:AjaxObserveField observeFieldID = "popUpButton"
updateContainerID = "globalContainerId" fullSubmit = "false" />
<wo:repetition list = "$list" item = "$item">
<wo:radioButton name = "RB" id ="$item" value = "$item"
selection = "$selectedItem" />
<wo:AjaxObserveField observeFieldID = "$item"
updateContainerID = "globalContainerId" fullSubmit = "true" />
<wo:string value = "$item" />
</wo:repetition>
<wo:conditional condition = "$popupIsYes">
<wo:textField id = "hiddenField" value = "$hiddenField" />
<wo:AjaxObserveField observeFieldID = "hiddenField"
updateContainerID = "globalContainerId" fullSubmit = "false" />
</wo:conditional>
</wo:AjaxUpdateContainer>
in java :
list = new NSArray<String> (new String[]{"Yes","No"});
public boolean popupIsYes() {
if (selectedItem().equalsIgnoreCase("Yes"))
{
return true;
}
return false;
}
+ get/set for item and selectedItem
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Attachment:
signature.asc
Description: Message signed with OpenPGP using AMPGpg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden