on 2005 Sep 20 1:17 PM
Hi,
In the view attached below for attachments, if no file is added then submit action should not happen. This is handled in the OnClientClick event of "AttachAdd" button which in turn calls the isFileLoaded function.
The document.forms[0].<%= controller->gc_document_path %>.value is always throwing error. I also tried document.getElementById('<%= controller->gc_document_path %>')
No form tag is used here. Can any one help me regarding this? The view is attached below for reference.
Thanks & Regards
G.Raja
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<%@extension name="CRM_BSP_IC" prefix="crmic" %>
<script>
function isFileLoaded()
{
if (document.forms[0].<%= controller->gc_document_path %>.value == '' ||
document.forms[0].<%= controller->gc_document_path %>.value == null)
return false;
else
return true;
}
</script>
<%
switch to correct encoding type for binary file upload
try.
DATA: frm TYPE REF TO CL_HTMLB_FORM.
frm ?= melem->get_class_named_parent( 'CL_HTMLB_FORM' ).
frm->encodingtype = 'multipart/form-data'.
frm->method = 'POST'.
catch cx_root.
endtry.
%>
<%
data: lt_attachments type O2PARAVALU_TABLE.
data: lv_attachment type crmt_ic_mail_attachment.
data: lv_del_mode type string.
data: lv_filename type string.
IF Attachments IS BOUND.
if Attachments->currentattachments is initial.
lv_del_mode = 'true'.
else.
lv_del_mode = 'false'.
endif.
ENDIF.
%>
<script type="text/javascript" language="javascript">
crmICWCswitchEnctypeToMultipart();
</script>
<crmic:tray2 id="ZOrderAttachments"
title="<%= otr(ZEID/Attachmenttitle) %>"
height = "100%,203"
width="100%">
<crmic:trayBody2>
<crmic:gridLayout cellSpacing = "1"
columnSize = "1"
rowSize = "5"
height = "100%"
width = "100%">
<crmic:gridLayoutCell colSpan="1"
columnIndex="1"
horizontalAlignment="LEFT"
rowIndex="1">
<htmlb:link id="Action"
onClick="Action"
text="<%= OTR(ZEID/ACTION) %>"/>
</crmic:gridLayoutCell>
<crmic:gridLayoutCell columnIndex="1" rowIndex="2" height="100%">
<crmic:tableView id = "Attachments"
headerText = "<%= otr(zEID/attachments) %>"
navigationMode = "BYPAGE"
table = "<%= Attachments->currentattachments %>"
selectionMode = "multiselect"
design = "alternating"
onRowSelection = "MyEventRowSelection"
fillUpEmptyRows = "true"
visibleRowCount = "3"
width = "100%" >
<crmic:tableViewCols>
<crmic:tableViewColumn columnName = "filetype"
title = "<%= otr(CRM_IC_APPL/type) %>"
type = "user" >
<htmlb:image src = "$TVCVALUE$"
/>
</crmic:tableViewColumn>
<crmic:tableViewColumn columnName = "filename"
title = "<%= otr(CRM_IC_APPL/document_name) %>"
type = "user"
linkColumnKey = "true" >
<htmlb:link id = "$TVCID$"
reference = "$URL$"
target = "_blank"
text = "$TVCVALUE$"
>
</htmlb:link>
</crmic:tableViewColumn>
</crmic:tableViewCols>
</crmic:tableView></crmic:gridLayoutCell>
<crmic:gridLayoutCell columnIndex="1" rowIndex="3"
><crmic:button id = "AttachAdd"
text = "<%= otr(CRM_IC_APPL/add) %>"
tooltip = "<%= otr(CRM_IC_APPL/add) %>"
onClick = "AddAttachment"
onClientClick = "if(!isFileLoaded()) htmlbevent.cancelSubmit = true;"
/> <crmic:button id = "AddtachDel"
disabled = "<%= lv_del_mode %>"
text = "<%= otr(CRM_IC_APPL/deletemail) %>"
tooltip = "<%= otr(CRM_IC_APPL/deletemail) %>"
onClick = "DeleteAttachments"
/> <htmlb:fileUpload id = "<%= controller->gc_document_path %>"
size = "30"
/></crmic:gridLayoutCell>
</crmic:gridLayout>
</crmic:trayBody2>
</crmic:tray2>
You are talking about a javascript problem here, so it is better to post the relevant part of your HTML source code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<htmlb:fileUpload will not work without a form
you need to have a form like below for <htmlb:fileUpload to work.
<htmlb:form method = "post"
encodingType = "multipart/form-data" >
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.