Re: AjaxObserveField with radioButtons
Re: AjaxObserveField with radioButtons
- Subject: Re: AjaxObserveField with radioButtons
- From: GILQUIN Pierre <email@hidden>
- Date: Thu, 15 Jun 2017 11:39:19 +0200
Thanks Ralf,
You are right that is the solution.
But I have a component used in many places. I still need to fix that in
the ajax wonder way ....
Pierre
Le 15.06.2017 à 11:30, Ralf Schuchardt a écrit :
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
<mailto: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
_______________________________________________
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