HTMLB RadioButton
Hi
I am using a HTMLB radioButton in a JSPDynpage.
I have a radiobutton group consisting of 2 radio buttons.
I am unable to get the selected value in Javascript.
I am using the following code
(eval(func("radiobuttonId"))).getChecked();
I get an error
"Undefined is null or not an object"
Can somebody help out please.
Hi Prakash
I tried your suggestion but it still doesn't work.
I have pasted my JSP code here so that you can have a look.
Towards the end there is a javascript function openwindow() where I am trying to alert the radio button values.
<%@ taglib uri= "tagLib" prefix="hbj" %>
<%@ page import = "com.sapportals.htmlb.enum.EventTrigger" %>
<% String buttonid = "";%>
<jsp:useBean id="ProductInfoBean" scope="application" class="bean.ProductInfoBean" />
<hbj:content id="myContext" >
<hbj:document>
<hbj:documentHead title="test"></hbj:documentHead>
<hbj:documentBody>
<hbj:form id="myFormId" >
<hbj:gridLayout
id="myGridLayout1"
debugMode="False"
width="40%"
cellSpacing="5"
>
<hbj:gridLayoutCell
rowIndex="1"
columnIndex="1"
width="10%"
horizontalAlignment="LEFT"
>
<hbj:textView
text="Title"
id="txtTitle"
tooltip="Title"
encode="false">
</hbj:textView>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell
rowIndex="1"
columnIndex="2"
width="10%"
horizontalAlignment="LEFT"
>
<hbj:inputField
id="ipTitle"
type="String"
invalid="true"
width="100"
value=""
visible="true"
disabled="false"
required="false"
maxlength="30"
size="50"
design="standard"
jsObjectNeeded="true"
>
<%
ipTitle.setClientEvent(EventTrigger.ON_KEYDOWN,"handle_enter()");
ipTitle.setClientEvent(EventTrigger.ON_CHANGE,"handle_titleChange()");
%>
</hbj:inputField>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell
rowIndex="2"
columnIndex="1"
width="10%"
horizontalAlignment="LEFT"
>
<hbj:textView
text="Promotion"
id="txtPromotion"
tooltip="Promotion"
encode="false">
</hbj:textView>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell
rowIndex="2"
columnIndex="2"
width="10%"
horizontalAlignment="LEFT"
>
<hbj:dropdownListBox
id="ddPromotion"
tooltip="Promotion"
disabled="false"
jsObjectNeeded="true"
>
<hbj:listBoxItem
key=""
value="- Select Promotion -"
/>
<%for(int i=0;i<ProductInfoBean.getPromotions().size();i++){%>
<hbj:listBoxItem
key="<%=(String)(ProductInfoBean.getPromotions().elementAt(i))%>"
value="<%=(String)(ProductInfoBean.getPromotions().elementAt(i))%>"
/>
<%}%>
<%
ddPromotion.setClientEvent(EventTrigger.ON_CHANGE,"handle_promotionChange()");
%>
</hbj:dropdownListBox>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell
rowIndex="3"
columnIndex="1"
width="10%"
horizontalAlignment="LEFT"
>
<hbj:textView
text="Selection #"
id="txtSelection"
tooltip="Selection #"
encode="false">
</hbj:textView>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell
rowIndex="3"
columnIndex="2"
width="10%"
horizontalAlignment="LEFT"
>
<hbj:inputField
id="ipSelection"
type="String"
invalid="true"
width="100"
value=""
visible="true"
disabled="false"
required="false"
maxlength="30"
size="50"
design="standard"
jsObjectNeeded="true"
>
<%
ipSelection.setClientEvent(EventTrigger.ON_KEYDOWN,"handle_enter()");
ipSelection.setClientEvent(EventTrigger.ON_CHANGE,"handle_selectionChange()");
%>
</hbj:inputField>
</hbj:gridLayoutCell>
</hbj:gridLayout>
<hbj:radioButtonGroup
id="rbgTypeSelect"
columnCount="2"
selection="rb_artwork"
>
<hbj:radioButton
id="rbArtwork"
text="Artwork"
key="rb_artwork"
tooltip="Extranet"
disabled="false"
jsObjectNeeded="true"
>
</hbj:radioButton>
<hbj:radioButton
id="rbProductDetails"
text="ProductDetails"
key="rb_productDetails"
tooltip="OVLC"
disabled="false"
jsObjectNeeded="true"
/>
</hbj:radioButtonGroup>
<hbj:button
id="searchButton"
text="Search"
tooltip="Please click to search"
disabled="false"
onClientClick = "openWindow()"
jsObjectNeeded="true"
>
</hbj:button>
</hbj:group>
</hbj:form>
</hbj:documentBody>
</hbj:document>
<script language="javascript">
function clearSearchCriteria(){
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
(eval(func("ipTitle"))).setValue("");
(eval(func("ipSelection"))).setValue("");
(eval(func("ddPromotion"))).setValue("");
function handle_enter(){
var src= window.event.srcElement;
k = window.event.keyCode;
if (k == 13) {
// enter key pressed
openWindow();
function handle_titleChange(){
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var title = (eval(func("ipTitle"))).getValue();
if(title != "")
(eval(func("ipSelection"))).setDisabled(true);
(eval(func("ddPromotion"))).setDisabled(true);
else
(eval(func("ipSelection"))).setDisabled(false);
(eval(func("ddPromotion"))).setEnabled(true);
function handle_selectionChange(){
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var selection = (eval(func("ipSelection"))).getValue();
if(selection !="")
(eval(func("ipTitle"))).setDisabled(true);
(eval(func("ddPromotion"))).setDisabled(true);
else
(eval(func("ipTitle"))).setDisabled(false);
(eval(func("ddPromotion"))).setEnabled(true);
function handle_promotionChange(){
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var promotion = (eval(func("ddPromotion"))).getValue();
if (promotion!=""){
(eval(func("ipTitle"))).setDisabled(true);
(eval(func("ipSelection"))).setDisabled(true);
else
(eval(func("ipTitle"))).setDisabled(false);
(eval(func("ipSelection"))).setDisabled(false);
function openWindow(){
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var title = (eval(func("ipTitle"))).getValue();
var selection = (eval(func("ipSelection"))).getValue();
var promotion = (eval(func("ddPromotion"))).getValue();
// var selType = (eval(func("rbProductDetails"))).getChecked();
var rb = eval(func(htmlb_radiobuttonmodifier+"rbArtwork")).getChecked();
var rb2 = eval(func(htmlb_radiobuttonmodifier+"rbProductDetails")).getValue();
alert("rb cheked " + rb);
alert("rb2 value " + rb2);
</script>
</hbj:content>
Similar Messages
-
Problem with html table and htmlb radiobutton group
Hello,
I wrote this code:
<table width="100%" border="1">
<tr>
<th>
Valutazione manageriale complessiva dell#anno
</th>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
<tr>
<th>
imprenditività
</th>
<htmlb:radioButtonGroup id="PROVA1"
columnCount="3"
mode="LOGICAL_GROUPING">
<th><htmlb:radioButton id="1" text="1" encode="TRUE"/></th>
<th><htmlb:radioButton id="2" text="2" encode="TRUE"/></th>
<th><htmlb:radioButton id="3" text="3" encode="TRUE"/></th>
</htmlb:radioButtonGroup>
</tr>
<tr>
<th>
Autorevolezza
</th>
<htmlb:radioButtonGroup id="PROVA2"
columnCount="3"
mode="LOGICAL_GROUPING">
<th><htmlb:radioButton id="1" text="1" encode="TRUE"/></th>
<th><htmlb:radioButton id="2" text="2" encode="TRUE"/></th>
<th><htmlb:radioButton id="3" text="3" encode="TRUE"/></th>
</htmlb:radioButtonGroup>
</tr>
</table>
but the third row (where there is "Autorevollezza/PROVA2") appears out of the table.
Do yuo now why?
Regards
Mariayou need to put the htmlb:radioButtonGroup Tags within the
tags
<tr>
<td>
imprenditività
</td>
<td>
<htmlb:radioButtonGroup id="PROVA1" columnCount="3" mode="LOGICAL_GROUPING">
<htmlb:radioButton id="1" text="1" encode="TRUE"></htmlb:radioButton></td>
<td><htmlb:radioButton id="2" text="2" encode="TRUE"></htmlb:radioButton></td>
<td><htmlb:radioButton id="3" text="3" encode="TRUE"></htmlb:radioButton>
</htmlb:radioButtonGroup></td>
</tr>
there is a invisible table rendered by htmlb and the browser does not know what to do when you put that between </tr> and </table> so he ends your table...
better you use <htmlb:gridLayout> instead of html-tables...
stefan -
HTMLB - RadioButton - setClientEvent Javascript
Hi All,
I have a radiobutton, on click of this i need to display another set of radiobuttons. For this I have javascript function which displays the DIV.
Below is the code for this.
<hbj:radioButtonGroup id="radioGrp" columnCount="1" selection="<%=testBean.getSelectedRadio()%>">
<hbj:radioButton id="radioBtn" key="name" text="Name" jsObjectNeeded="true">
<%
radioGrp.getRadioButtonForKey(radioBtn).setClientEvent(com.sapportals.htmlb.enum.EventTrigger.ON_CLICK, "onSelectRadio('radioBtn)");
%>
</hbj:radioButton>
This works perfectly fine. When i select the radio button, the javascript function is displayed and relative DIV is displayed.
But the problem here is, if I select the radio button and due to any other event on the page, if the page gets refreshed, I am getting below exception (Portal Runtime error) .
Caused by: com.sapportals.htmlb.page.PageException: Eventhandler- "com.sapportals.htmlb.event.LinkClickEvent" or "onCom.sapportals.htmlb.event.LinkClickEvent" not found! '
I have imported the EventTrigger and Event in the jsp. If I comment the radiobutton code, I am not geting the above error.
Please let me know your thoughts . I have been struggling to find a solution for this issue.
Thanks
Sudha
Edited by: sona p on Jan 14, 2010 9:19 PMHi,
Try alerting "(theRadio.type)".
If you are getting the proper checkbox instance then the alert should display "checkbox". If that much is working then checking the checkbox is as simple as
var theRadio = eval(func(grpId + htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
if(theRadio)
theRadio.checked = true
By the way what does the function "func" do?
Regards,
Satyajit -
Two bugs in SP9 HTMLB radioButton?
I am trying to trigger a client-side event when a radio button is clicked. There are examples of this, but involve embedding Java in the JSP in the radioButton tag. When I do that, there are two problems. First, the object is null and cannot be accessed. Second, the text label for the radio button disappears.
<hbj:radioButtonGroup
id="rbgSearchSelect"
columnCount="1"
selection="<%=SearchBy%>">
<hbj:radioButton
id="rbSubscriptionSelect"
jsObjectNeeded="true"
text="Search by popular"
key="101"
disabled="false" >
<% // rbSubscriptionSelect is null, and text does not appear %>
</hbj:radioButton>
</hbj:radioButtonGroup>
If I simply remove the <% %> line, the text label appears again. Moving the code to add the client event to the bottom should also work, but the object is still null, even if you try to get it directly from the pageContext object (where the internal code puts it). Here's the code I want to add:
rbSubscriptionSelect.setClientEvent(EventTrigger.ON_CLICK, "myfunc()");
Does anyone have a working example of setting a client-side event on a radio button on EP6 SP9?Have you seen these Blogs??
Portal: Bug in the radio button's javascript api
Useful undocumented javascript code for portal
Regards,
P. -
Javascript check on HTMLB radiobutton in radiobutton group
Hi
I want to check which radio button in my htmlb radio buttongroup is selected.
I have tried to
alert(eval(func("myButtonGroup"+htmlb_radiobuttonmodifier.substring(3,7)+"1")));
but alert only shows 'undefined'.
Is there any way to actually check what exactly I must inside "" in eval(func(""))?
thanks in advance
Anton KruseHi,
First call a javascript function on selection of a radio button and inside that function write the following code.
<script language="javascript">
function checkRadio() {
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
//you have to use the name of radio group
var rb1 = eval(func("myButtonGroup" +
htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
alert(rb1.getValue());
alert(rb1.getChecked());
</script>
Regards,
Tamil K -
Preselect Htmlb Radiobutton using javascript
Hi Experts,
when I click on a button, i want to preselect a radiobutton using javascript.
I am using below code to get the instance of the radiobutton in the javascript, but I am unable to select the radiobutton.
var theRadio = eval(func(grpId + htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
Thanks in advanceHi,
Try alerting "(theRadio.type)".
If you are getting the proper checkbox instance then the alert should display "checkbox". If that much is working then checking the checkbox is as simple as
var theRadio = eval(func(grpId + htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
if(theRadio)
theRadio.checked = true
By the way what does the function "func" do?
Regards,
Satyajit -
Radiobuttons in tableView/iterator environment
Hi,
I'd like to build and display a matrix of radiobuttons with a name/title for each row and also for each column. Every row of the matrix should form a radiobutton group, i.e. per line one and only one radiobutton should be selectable.
Both dimensions of the matrix are dynamic so I thought I could use a <htmlb:tableView> with a column-definitions table defining the number and names of the columns, the 'actual' table containing the names of the rows and an iterator which just renders these names in the first (i.e. 'zeroth'-) column and radiobuttons in all other columns.
The code in <i>if_htmlb_tableview_iterator~render_cell_start</i> pretty much contains only the lines
rowindex_as_id = p_row_index.
colindex_as_key = p_column_index.
p_replacement_bee = cl_htmlb_radiobutton=>factory( id = rowindex_as_id key = colindex_as_key ).
Unfortunately the radiobuttons don't get rendered, the resulting page contains the desired table with the row and column titles but empty cells. The html sources contains the comments
<!-- *** Unidentified control NOT rendered *** -->
Now, this might be due to a missing radiobutton group that would contain the radionbuttons of one line.
I don't understand however how a <i>cl_htmlb_radiobutton</i> object gets to know its radiobutton group container. Neither the factory used above nor the constructor nor any other method allows to set a reference to a radiobutton group object. It does contain an attribute <i>radiobuttongroup</i> though, but this is protected!?!
Does anybody have an idea/experience with this?
Regards,
SebastianHallo Sebastian,
First let me address your questions concerning the "parent" of a tag. In principle it is only possible to process a tag in context of a BSP page. In this context "process" means either writing the tag on a BSP page, or dynamically processing the tag. When the tag is processed, it is placed on a stack. The opening sequence puts the tag on the stack, the close sequence removes the tag from the stack. Each tag can query the stack of previous tags to find a specific type or parent. Typical code would be:
DATA: rbg TYPE REF TO CL_HTMLB_RADIOBUTTONGROUP.
rbg ?= m_page_context->GET_CLASS_NAMED_PARENT(
class_name = 'CL_HTMLB_RADIOBUTTONGROUP' ).
<b><u>OR</b></u>
DATA: rbg TYPE REF TO CL_HTMLB_RADIOBUTTONGROUP.
rbg ?= m_page_context->GET_ELEMENT_NAMED_PARENT(
extension = 'HTMLB'
name = 'RADIOBUTTONGROUP' ).
<b><u>OR</b></u>
DATA: rbg TYPE REF TO CL_HTMLB_RADIOBUTTONGROUP.
rbg ?= m_page_context->GET_DIRECT_PARENT( ).
Next aspect is the error message "Unidentified control NOT rendered". What this means is that deep down in the code we get a reference onto a control which we can not render anymore. It is suddenly not known. Hmmm... let us dig.
What I then checked is with the use of the <htmlb:radioButton>. This control insist that it can only be used inside a <htmlb:radioButtonGroup>. Which actually makes sense. So if no group, then raise error.
Which brings us to your message above. While deep in the rendering, these types of unknown problems are caught and dropped. This is when you get this generic message. It is actually the exception about the missing radioButtonGroup on the stack.
What we usually do, is place the <htmlb:radioButtonGroup> around the <htmlb:tableView>. But this only works when you are using one column of radioButtons. Which you are not.
Current feeling would be to look at some executive programming: consider to use a <phtmlb:matrix> and just roll your own. For an idea of where the journey can go, look at the examples of <phtmlb:formLayout>.
brian -
BSP code - radiobutton - search button
Hello BSP gurus,
Ok, so far I have this piece of code. The idea is to click on a radiobutton and then click on the search button in order to go to the next screen (the result screen).
Does anyone have an idea how to handle this?
Thanks in advance.
<htmlb:radioButton id = "rad1"
key = "r1"
disabled = "false"
text = "Report 1"
checked = "false"
/>
<htmlb:button id = "search"
text = "Search"
onClick = "onInputProcessing(select)" />Here you go..
<b>To display more than 1 Radiobutton:</b>
<htmlb:radioButtonGroup id = "grp1"
columnCount = "4"
disabled = "false"
mode = "LAYOUT_GROUPING"
selection = "<%= selected %>"
tooltip = "This is my RadioButton Group"
width = "500" >
<htmlb:radioButton id = "rad1"
key = "r1"
tooltip = "This is a radio button1"
text = "search1"
/>
<htmlb:radioButton id = "rad2"
key = "r2"
tooltip = "This is a radio button2"
text = "search2"
checked = "true"
onClick = "click2" />
</htmlb:radioButtonGroup>
<b>To capture selected Radiobutton:</b>
DATA: rbg TYPE REF TO CL_HTMLB_RADIOBUTTONGROUP.
rbg ?= CL_HTMLB_MANAGER=>GET_DATA( request = request id = 'grp1' name = 'grp1' ).
if rbg is not initial.
selected = rbg->selection.
if selected = 'r1'.
navigation->goto_page( 'result_page1.htm');
elseif selected = 'r2'.
navigation->goto_page( 'result_page2.htm');
endif.
endif.
Raja T
<b>* Reward each useful answer</b> -
I want to click on text of radioButton....
I inserted a htmlb:readioButtonGroup into my Application.
I noticed that the radioButton can only be activated by clicking on the button itself, not by clicking on the text. Is there any way to enable this?
<htmlb:radioButtonGroup id = "rbgrp">
<htmlb:radioButton id = "rdb1"
text = "<%= lv_txt %>"
key = "<%= lv_key %>"
checked = "<%= lv_checked %>"
tooltip = "bla" />
</htmlb:radioButtonGroup>i use the following code and this allows me to click the text to selecte the radiobutton.
<htmlb:radioButtonGroup id = "RBG2"
columnCount = "3"
selection = "<%= r2sel %>"
width = "100%" >
<htmlb:radioButton id = "RB21"
text = "Daily"
checked = "TRUE" />
<htmlb:radioButton id = "RB22"
text = "Month End" />
<htmlb:radioButton id = "RB23"
text = "Year End" />
</htmlb:radioButtonGroup>
Regards
Raja
Message was edited by: Durairaj Athavan Raja -
Accessing HTMLB from javascript
Hi expert,
Can someone explain how to access the attributes,methods avialable in javascript to access htmlb objects in a page,
Like for e.g.,
htmlbSL(this,2,'SUBMITVALUES:HandleSubmit')
Is there any document available?
Thank you
APHi AP,
I believe there is no documentation avaliable about this.
Maybe because this accessing method is not right to do
but I can explaint about the function htmlbSL
function htmlbEL(this,2,'SUBMITVALUES:HandleSubmit');
this = HTML element.
2 = event type index.
SUBMITVALUES:HandleSubmit = objectID:eventName
if you want to know list of event type index.
here the list:
<b>EVENT TYPE INDEX</b>
'htmlb:breadCrumb:click' 1
<b>'htmlb:button:click' 2</b>
'htmlb:checkbox:click' 3
'htmlb:image:click' 4
'htmlb:link:click' 5
'htmlb:radioButton:click' 6
'htmlb:tabStrip:click' 7
'htmlb:tree:click' 8
hope this can help you.
respeck,
-adyt- -
Tutorial or manual for HTMLB tag
Hello,
have you e manual or tutorial that explain tags for htmlb language, for example htmlb:radiobutton mode.
Regards
MariaHi maria,
Yes i can tell you the steps where you can find the documentation of HTMLB ttags
using SE80 -> Tag Browser -> BSP Extensions -> Transportable -> htmlb
and also check the [link|http://www.sdn.sap.com/irj/sdn?contenttype=url&content=http%253a//forums.sdn.sap.com/thread.jspa%253fthreadid%253d35858]
This is defintely solve ur problem
Cheers,
bhavana
Edited by: Bhavana Amar on Sep 13, 2010 7:13 PM -
How to trap Submit button event in OAF
Hello,
I'm doing controller extension for create account button in Customer UI.
Issue: I'm not able to trap the table action to add extra validation logic.
I tried to use pageContext.getParameters("CreateButton") but it didn't work i.e. debug message was not printed written inside if statement.
Button Structure:
TableAction
Flowlayout
Submit button.
Code:
public void processFormRequest(OAPageContext pageContext,
OAWebBean webBean) {
//super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
ArrayList exceptions = new ArrayList();
OAFlowLayoutBean oaflowlaybean =
(OAFlowLayoutBean)webBean.findChildRecursive("TableActionsRN");
OASubmitButtonBean vbuttonBean =
(OASubmitButtonBean)oaflowlaybean.findChildRecursive("CreateButton");
String buttonId = vbuttonBean.getID();
String buttonId12 = vbuttonBean.getName();
String asd=vbuttonBean.getEvent();
String s = pageContext.getParameter(EVENT_PARAM);
String s1 = pageContext.getParameter(vbuttonBean.getName());
if (s.equalsIgnoreCase("CreateAccount")) {
OAViewObject vo =
(OAViewObject)am.findViewObject("HzPuiAccountTableVO");
if (vo != null) {
pageContext.writeDiagnostics("Jai-1", "VO Found", 1);
OARow row = (OARow)vo.getCurrentRow();
if (row != null) {
pageContext.writeDiagnostics("Jai-2", "Row Found", 1);
String partyid =
(String)row.getAttribute("PartyId").toString();
pageContext.writeDiagnostics("Jai-3", "PartyId" + partyid,
1);
int PartyNum = Integer.parseInt(partyid);
String partyacctcnt = null;
try {
OracleConnection conn =
(OracleConnection)pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
pageContext.writeDiagnostics("Jai-4", "Inside Try", 1);
String query =
"SELECT count(1) lcount FROM HZ_CUST_ACCOUNTS WHERE party_id=:1";
PreparedStatement stmt = conn.prepareStatement(query);
stmt.setInt(1, PartyNum);
ResultSet resultset = (ResultSet)stmt.executeQuery();
if (resultset.next()) {
pageContext.writeDiagnostics("Jai-5",
"Inside Result Next",
1);
partyacctcnt = resultset.getString("lcount");
stmt.close();
} catch (SQLException sqlexception) {
throw OAException.wrapperException(sqlexception);
int i = Integer.parseInt(partyacctcnt);
/* String HoldFlag = (String)row.getAttribute("Attribute11");
// Check Hold Flag: "Y" then restrict to create new account
if (HoldFlag == "Y") {
pageContext.writeDiagnostics("Jai", "Inside Hold Flag", 1);
exceptions.add(new OAException("XXGCO",
"XXTCO_CREDIT_LIMIT_CHECK",
null, OAException.ERROR,
null));
// One Party-One Account: Greater or Equal to 1 then throw error mesaage
if (i > 1) {
pageContext.writeDiagnostics("Jai-6",
"Inside Account Check",
1);
exceptions.add(new OAException("XXGCO",
"XXTCO_CREDIT_LIMIT_CHECK",
null, OAException.ERROR,
null));
if (exceptions.size() > 0) {
pageContext.writeDiagnostics("Jai-7",
"Inside Exceptioon calling",
10);
OAException.raiseBundledOAException(exceptions);
} else {
pageContext.writeDiagnostics("Jai-8",
"Inside else Exceptioon calling",
10);
// super.initParametersPFR(pageContext,webBean);
vbuttonBean.setFireActionForSubmit(null, null, null, false);
super.processFormRequest(pageContext, webBean);
Please suggest the how to overcome with above mention issue.Hi Kiranmai,
You can capture the event of the radio button in the following way in oninputprocessing.
DATA: event TYPE REF TO if_htmlb_data,
radioButton_event TYPE REF TO CL_HTMLB_EVENT_RADIOBUTTON.
event = cl_htmlb_manager=>get_event( request ).
IF event IS NOT INITIAL AND event->event_name = htmlb_events=>radiobutton.
radioButton_event ?= event.
ENDIF.
you can get the attributes of clicked radio button in
event->event_class
event->event_id.
event->event_name
event->event_type
event->event_server_name
In layout define the radio button as
<htmlb:radioButtonGroup id = "test_id">
<htmlb:radioButton id = "id_red" text = "Red" onClick="myClick" />
<htmlb:radioButton id = "id_blue" text = "Blue" onClientClick="alert('blue clicked')"/>
<htmlb:radioButton id = "id_green" text = "Green" onClick="myClick" onClientClick="alert('green clicked')"/>
</htmlb:radioButtonGroup>
Hope this will solve your problem.
Donot forget to assign points for helpful answers.
Regards
Aashish Garg -
Assign a Javascript variable value to a ABAP variable
Hi,
I wish to assign a javascript variable value to a ABAP variable. Any ideas how to do that?
Many thanks.
Rgds,
BerniceHere's another suggestion for you.
BSP Application: SBSPEXT_HTMLB
Check out the radionbuttongroup.bsp
So then instead of using a standard HTML radio buttons you can use the HTMLB element with the parameter for onClick set then in your DO_HANDLE_EVENT you can read the value.
VIEW
<htmlb:radioButtonGroup id="radio">
<htmlb:radioButton id="id_link"
text="Link"
onClick="myClickHandler"/>
<htmlb:radioButton id="id_unlink"
text="Unlink"
onClick="myClickHandler"/>
</htmlb:radioButtonGroup>
DO_HANDLE_EVENT
DATA: lt_event TYPE REF TO if_htmlb_data.
lt_event = cl_htmlb_manager=>get_event_ex( request ).
if lt_event IS NOT INITIAL.
if lt_event->event_name = htmlb_events=>radiobutton.
case lt_event->event_id.
when 'control_id_link'.
schalter = ' '..
when 'control_id_unlink'.
schalter = '1'.
endcase.
endif.
endif.
There is an example of how to use it and read it in the DO_HANDLE_EVENT you then just have to pass the variable around (in this example the variable name is schalter and is defined as char1 in the class) -
Issue while printing the BSP page haveing radio buttons.
Hi Experts,
I have a BSP page which has radio buttons. When i try to print the page using browser print, the radio buttons are not getting printed.
Could someone help me regarding this.
Thanks & Regards,
Karthik MDwhen you use radiobutton in BSP (<htmlb:radioButton) they are rendered as images. so to get it printed , in your browser (IE) go to tools->internet options->advanced->printing and check the check box against "print background colors and images".
now try printing it should be fine. -
Regarding Model Data Binding.
Hi Jain,
Data binding enables data transfer between views and models, so that we don't have to add or change controller coding to work with models.
Syntax for DataBinding:
For <htmlb:InputField>
<htmlb:InputField value="//query/a"/>
This example code creates an inputfield that takes its initial value from the a attribute of query model.
here query is the instance for model we can define in conroller Do init method.
For ex if you want to add two numbers by using model data binding.
Create method add in model which has three attributes value1,value2, and result.We have to define these attributes in model.Result is to print the added vaue.
Then we have to add these values to the model in the view by using above syntax:
<htmlb:InputField value="//query/value1"/>
<htmlb:InputField value="//query/value2"/>
<htmlb:InputField value="//query/result"/>
here query is instance for the model.
Here you have to remeber one point that no need to define these attributes(value1,value2,result) in the view again but you have define model instance in the attributes of view.
Try using this concept..........
Reward points if useful.Hi Anubhav,
Model Data Binding in business server pages ensure that data which is entered by the user in
the user interface(view) automatically passes to the model attributes and also output from the
backend system automatically passes to the result view.
So we need n't handle the data which is going to backend or the data which is coming from
backend system.
Data binding takes care of all the data handling .so we need n't write code to handle the data.
All i can say is data binding means binding the UI elements with the model class attributes.
If data binding is not available in BSP, we would have written lot of code in controller class
of business server pages.
I am giving simple example here to make you understand.
The initial view in this application contains 2 input fields, 4 radio buttons and 1 button.
Here radio buttons named Add, Multiple , Subtract and Divide.
The functionality i this application is whenever user enters numbers in input fields and select on
radio button and click on button , the result has to be displayed in the result view.
Initial View:
<htmlb:content design="design2003">
<htmlb:page title = " ">
<htmlb:form>
<htmlb:textView text = "value1"
design = "EMPHASIZED" />
<htmlb:inputField id = "f1" value = "//model/v1" />
<htmlb:textView text = "value2"
design = "EMPHASIZED" />
<htmlb:inputField id = "f2" value = "//model/v2" />
<htmlb:radioButtonGroup id="rbg" selection="//model/s" >
<htmlb:radioButton id="id_add" text="add"/>
<htmlb:radioButton id="id_sub" text="sub"/>
<htmlb:radioButton id="id_mul" text="mul"/>
<htmlb:radioButton id="id_div" text="div"/>
</htmlb:radioButtonGroup>
</htmlb:form>
This code in the above view shows the data binding;
<htmlb:inputField id = "f1" value = "//model/v1" /> and
<htmlb:inputField id = "f2" value = "//model/v2" /> and
<htmlb:radioButtonGroup id="rbg" selection="//model/s" >
Here v1,v2 and s are model class attributes . model is reference variable of model class .model is declared
as page attribute in BSP.
As i said above automatically the values of inputfields are passes to the model class without writing the code.
Code in model class method:
METHOD toall.
IF s = 'id_add' .
v3 = v1 + v2.
ELSEIF s = 'id_sub'.
v3 = v1 - v2.
ELSEIF s = 'id_mul'.
v3 = v1 * v2.
ELSE.
v3 = v1 / v2.
ENDIF.
ENDMETHOD.
</htmlb:page>
</htmlb:content>
Result View:
<htmlb:content design="design2003">
<htmlb:page title = " ">
<htmlb:form>
<htmlb:textView text = "output"
design = "EMPHASIZED" />
<htmlb:textView text = "//model/v3"
design = "EMPHASIZED" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Here the result is available v3 attribute of model class and it is binded to the text view of the result view.
Finally the result is displayed in result view.In the above example i didn't explain about controller class
I hope you know about controller class.
Hope it helps.
Reward points,if found useful.
Thanks,
Narendra.M
Maybe you are looking for
-
How do I get firefox to load in internet explorer instead of internet explorer 64
firefox is in internet explorer 64 but I want it in internet explorer
-
Anybody familiar with the details of implementing the Adobe PDF virtual printer?
Hello, all. We need to implement a virtual printer similar to the legendary one by Adobe. The images processed by it will be detailed CAD drawing. Can a kind soul point me in the appropriate direction? For starters: what type of data (what format) is
-
Why does the option to print front to back only appear randomly?
Have only seen the option to print back to front offered once or twice - why isn't it always there?
-
My ipad1 won't play movies on my tv even though it is connected via VGA adapter,
Why won't my ipad 1 play movies on my tv via the ipad VGA adapter?
-
Who to use "xfa.event.newText" for value and not text
Hello, What is the righr method for returning the value from a "list". xfa.event.newText return's the texte value i want le value. exemple : Text = USA Value=us Text=France Value=fr Thanks