How to validate an text field item using javascript for numbers only.
hi,
how to validate an text field item using javascript for numbers only.please help me on this urgent
please mail me solun if posible on [email protected]
Hi,
Page HTML header
<script>
function onlyNum(evt) {
// Usage: onKeyPress="return onlyNum(event)"
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
var status = 'This field accepts numbers only!';
alert(status);
return false;
var status = '';
return true;
</script>Item HTML Form Element Attributes
onKeyPress="return onlyNum(event)"Br,Jari
Similar Messages
-
How to Validate the Text Field in JSF
Hi,
I am facing a issue to validate the text field where the below code accepts (space' ',underscore'_',pipe'|') symbol as a first character and last character.Where by it can accept in the middle.
It should not accept special characters also. Below code is working properly for special characters.
<tr>
<td width="30%" align="right"><b><h:outputText id="aAccrualType" value="Accrual Type" /> </b> <span style="color:red">*</span></td>
<td width="50%">: <h:inputText id="accrualType" value="#{accrualTypeMast.accrualType}" required="true" >
<t:validateRegExpr pattern="^[(a-z)||(A-Z)||(0-9)||(_)||(\s)||(/)]+$" />
<f:validateLength minimum="1" maximum="50"/>
</h:inputText>
<h:message for="accrualType" showDetail="true" style="color:red" />
</td>
</tr>
The thing is i dont have much knowledge in regular expression.
Is there any other way to do this.
Could anyone help me in this.
Thanks,
Ambika☺This has nothing to do with JSF.
I suggest you to read the Pattern API documentation [1]. You can easily create a small Java Application and test the regexp using String#matches() as it uses the same regexp guidelines.
public static void main(String[] args) {
String regexp = "^[a-z]+$";
String value = "foo";
boolean match = value.matches(regexp);
System.out.println(value + " matches " + regexp + ": " + match);
}[1] http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html -
How to validate a text field??
Can any one tell me hot to validate a text field??
I want to create a text field which holds alphabets only..You can use simple javascript code in the liveChange function such as the following (for sap.m.Input):
liveChange: function(evt) {
var inputValue = evt.getSource().getValue();
this.setValueState(me.validateTagName(inputValue));
this.validateTagName = function(inputValue) {
if (inputValue.trim().length < 1) {
return "Error";
} else {
return "None";
Ran -
How to insert more than 12 items using BDC for MB1C
Hi,
When we use LSMW for data transfer of MB1C transaction, more than 12 items can be inserted in a document.
But using BDC only 12 and below is possible, if the flat file system has more that 12 item, then the document is not created.
How to insert more than 12 item in a document.
RegardsHi Gow,
I have uploaded the MB1C through a BDC and it is working fine for n no of items.
Here is the code. May be this will be of your help.
*& Report ZMB1C
report ZMB1C
no standard page heading line-size 255.
type-pools : slis.
tables : t100.
data: begin of record,
MATNR(018),
ERFMG(017),
EXBWR(016),
end of record.
data : itab like table of record with header line.
data : w_bdcdata type bdcdata.
data : t_bdcdata type standard table of bdcdata initial size 1.
data : messtab type standard table of bdcmsgcoll with header line.
data : mstring(300).
data : vf_index type i,
no_lines type i,
count type i value 0.
data : v_bldat(20),
v_budat(20).
*Excel Sheet Data Upload Details
data : vf_start_col type i value '1', "start column
vf_start_row type i value '2', "start row
vf_end_col type i value '100', "maximum column
vf_end_row type i value '10000'. "maximum row
*/ Internal Table For Excel Data
data : it_excel type kcde_cells occurs 0 with header line.
*/ Field symbol
field-symbols : <fs>.
data : begin of it_messtab occurs 0,
plant(10) type c,
status(10) type c,
message(90) type c,
end of it_messtab.
*Data for ALV display
data : wa_fcat type slis_fieldcat_alv,
colcnt type i.
data : it_fieldcat type slis_t_fieldcat_alv,
i_events type slis_t_event.
data : l_title type sychar70.
data : l_repid like sy-repid.
* Selction Screen
selection-screen begin of block b1 with frame title text-000.
parameters : p_file like ibipparms-path obligatory,
p_mode like ctu_params-dismode default 'A'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-001.
parameters : p_bldat like MKPF-BLDAT obligatory,
p_budat like MKPF-BUDAT obligatory,
p_bwart like RM07M-BWARTWA obligatory,
p_werks like RM07M-WERKS obligatory,
p_lgort like RM07M-LGORT obligatory.
selection-screen end of block b2.
* At Selction Screen
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ''
IMPORTING
file_name = p_file.
*Start of Selection Event
start-of-selection.
call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = vf_start_col
i_begin_row = vf_start_row
i_end_col = vf_end_col
i_end_row = vf_end_row
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if it_excel[] is initial.
MESSAGE I000(ZCL_TCSABAP).
else.
sort it_excel by row col.
loop at it_excel.
move : it_excel-col to vf_index.
assign component vf_index of structure itab to <fs>.
move : it_excel-value to <fs>.
at end of row.
append itab.
clear itab.
endat.
endloop.
endif.
if not itab[] is initial.
DESCRIBE TABLE itab LINES no_lines.
clear messtab.
refresh messtab.
CONCATENATE p_bldat+6(2) '.' p_bldat+4(2) '.' p_bldat(4) into v_bldat.
CONCATENATE p_budat+6(2) '.' p_budat+4(2) '.' p_budat(4) into v_budat.
perform map_rec.
call transaction 'MB1C' using t_bdcdata mode p_mode update 'A'
messages into messtab .
clear t_bdcdata.
refresh t_bdcdata.
loop at messtab where msgtyp = 'E' or msgtyp = 'S' .
select single * from t100 where sprsl = messtab-msgspra
and arbgb = messtab-msgid
and msgnr = messtab-msgnr.
if sy-subrc = 0.
mstring = t100-text.
if mstring cs '&1'.
replace '&1' with messtab-msgv1 into mstring.
replace '&2' with messtab-msgv2 into mstring.
replace '&3' with messtab-msgv3 into mstring.
replace '&4' with messtab-msgv4 into mstring.
else.
replace '&' with messtab-msgv1 into mstring.
replace '&' with messtab-msgv2 into mstring.
replace '&' with messtab-msgv3 into mstring.
replace '&' with messtab-msgv4 into mstring.
endif.
condense mstring.
it_messtab-message = mstring(300).
it_messtab-plant = p_werks.
if messtab-msgtyp = 'E'.
it_messtab-status = 'Error'.
else.
it_messtab-status = 'Success'.
endif.
append it_messtab.
clear it_messtab.
endif.
endloop. "messtab
if not it_messtab[] is initial.
perform buildcatalog.
perform display.
endif.
endif.
*& Form Map_Rec
* text
form map_rec.
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
'RM07M-WVERS3'.
perform bdc_field using 'BDC_OKCODE'
'NPE'.
perform bdc_field using 'MKPF-BLDAT'
v_bldat.
perform bdc_field using 'MKPF-BUDAT'
v_budat.
perform bdc_field using 'RM07M-BWARTWA'
p_bwart.
perform bdc_field using 'RM07M-WERKS'
p_werks.
perform bdc_field using 'RM07M-LGORT'
p_lgort.
perform bdc_field using 'XFULL'
perform bdc_field using 'RM07M-XNAPR'
'X'.
perform bdc_field using 'RM07M-WVERS2'
perform bdc_field using 'RM07M-WVERS3'
'X'.
loop at itab.
count = count + 1.
perform bdc_dynpro using 'SAPMM07M' '0410'.
perform bdc_field using 'BDC_CURSOR'
'MSEG-EXBWR'.
if count <> no_lines.
perform bdc_field using 'BDC_OKCODE'
'=NPE'.
elseif count = no_lines.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
endif.
perform bdc_field using 'MSEG-MATNR'
itab-MATNR.
perform bdc_field using 'MSEG-ERFMG'
itab-ERFMG.
perform bdc_field using 'MSEG-EXBWR'
itab-EXBWR.
endloop. "itab
endform. "Map_Rec
** Form BDC_DYNPRO
form bdc_dynpro using program dynpro.
clear w_bdcdata.
w_bdcdata-program = program.
w_bdcdata-dynpro = dynpro.
w_bdcdata-dynbegin = 'X'.
append w_bdcdata to t_bdcdata.
endform. "bdc_dynpro
** Form BDC_FIELD
form bdc_field using fnam fval.
if fval <> space.
clear w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
append w_bdcdata to t_bdcdata.
else.
clear w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
append w_bdcdata to t_bdcdata.
endif.
endform. "bdc_field
* FORM buildcatalog *
form buildcatalog.
clear wa_fcat.
clear it_fieldcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'PLANT'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'PLANT'.
wa_fcat-key = 'X'.
wa_fcat-outputlen = '10'.
append wa_fcat to it_fieldcat.
clear wa_fcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'STATUS'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'STATUS'.
wa_fcat-outputlen = '10'.
append wa_fcat to it_fieldcat.
clear wa_fcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'MESSAGE'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'Message'.
wa_fcat-outputlen = '90'.
append wa_fcat to it_fieldcat.
endform. "buildcatalog
* FORM display *
form display.
l_title = text-002.
l_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_grid_title = l_title
it_fieldcat = it_fieldcat
it_events = i_events[]
TABLES
t_outtab = it_messtab
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. "display
Regards,
Amit -
How to get the text field in the header for only first page of the report
Hi,
I am developing reports in BI Publisher Enterprise where i am facing problem i.e., i have to get some text field in header,for only first page in the result but it is displaying in all the other pages of the report in result.So,please if you have any idea of how to solve it, please reply.It is required as early as possible.
Thanks in AdvanceInvalid path? What are you doing? Writing the report output to an invalid directory?
Where are your terms and conditions? It would be very easy just to put them in a database table and select them in your report query. -
How to validate empty Text Field?
Hi,
I am Thirupathi,
I am new to JSF. I am able to validate the value of a component which has some value using attribute
validator="#{UserNumberBean.validate}"
in this case it is calling validate method of UserNumberBean.
but if i keep the field empty then it is not calling that validate method of UserNumberBean.
Please can any one clarify my doubt.
wait for reply
Thanx in advance.
Thirupathi Reddy
mail Id: [email protected]validate method is called to validate the correctness of the value input by user (eg. email format, phone numebr etc.). If user leaves the input box empty then there is nothing to validate and so validate is not called.
If you want customised messages for required fields you can use requiredMessage attribute in your inputText tag provide that you are using JSF1.2. It is not available in JSF1.1. In JSF1.1 it is requires some extra coding. You can do like this :
In your managed bean
public class MyBean {
private String userName = "";
private String password = "";
private ArrayList errors = new ArrayList();
public String getErrors() {
String message;
if (errors.size() == 0) {
message = "";
} else {
message = "<FONT COLOR=RED><UL>\n";
for(int i=0; i<errors.size(); i++) {
message = message + "<LI>" +
(String)errors.get(i) + "\n";
message = message + "</UL></FONT>\n";
return(message);
public String validateUser() {
errors.clear();
if (userName == null || userName.trim().length() == 0) {
errors.add("User Name is required");
if (password == null || password.trim().length() == 0) {
errors.add("password is required");
if (errors.size() > 0) {
return(null);
} else {
//perform your logic here
return("returnString");
}In your jsp page, include the errors tag as below. It will show all errors on top of the page.
<f:view>
<h:form>
<h:outputText value="#{MyBean.errors}" escape="false"/>
<p>User Name: <h:inputText value="#{MyBean.userName}" /></p>
<p>Password: <h:inputText value="#{UserBean.password}" /></p>
<h:commandButton value="Login" action="#{UserBean.validateUser}" />
</h:form>
</f:view>One point to remember is to clear the errors List in every action.
Hope it helps.
-Hitesh -
Indesign Scripting: How can I move a placed item using Javascript?
Hey all,
I have been trying to write a script that places a slug object from an indesign library on to a document and then moves it to my slug area. It all seems to work except the move command. I think the problem is that I haven't selected my placed asset correctly.
Please help!
This is what I have so far:
//Create new document
var doc = app.documents.add();
// Get page size values
var w = doc.documentPreferences.pageWidth;
var h = doc.documentPreferences.pageHeight;
//Create layer called SLUG
var slugLayer = doc.layers.add({name:"SLUG"});
//Set document slug area size
doc.documentPreferences.documentSlugUniformSize = false;
doc.documentPreferences.slugBottomOffset = "20 mm";
//Open InDesign library file that contains the slug file
var slugLibrary = app.open(File("/Users/Shared/Slug.indl"));
//Place slug script to go here
var myPlacedAsset = slugLibrary.assets.item("Slug");
var mySlug = myPlacedAsset.placeAsset(doc);
//Close the slug library
slugLibrary.close();
// Move slug object to slug area
mySlug.move([0,0]);
//Lock SLUG layer
slugLayer.locked = true;placeAsset is an array so this line : mySlug.move([0,0]);
should be changed to: mySlug[0].move([0,0]); -
How do I edit a field so that it accepts numbers only?
I've seen java scripts posted and none of them have worked for me. Perhaps it's that I'm not sure exactly how or sure where to enter the script, or which script to use. I've also tried using the arbitrary mask feature and entered 9 in the box, but the form still accepts letters in Reader. Help please!
What kind of form are you referring to? Are you trying to use Adobe Contribute or something else? It's hard to tell what's up from your question. Sounds like you are using Adobe Acrobat or something.
-
How to hide text field item based on true or false cases in oracle apex
Hi,
I have a set of text Field items in oracle apex:
Order Number
Revision Number
When we open the report, revision should be hidden.
Only when the user enters unique order number (non-duplicate order numbers), revision number should be visible.
If he enters duplicate order number, revision number should be hidden.
Please help.Hi 2932464,
2932464 wrote:
Hi,
I have a set of text Field items in oracle apex:
Order Number
Revision Number
When we open the report, revision should be hidden.
Only when the user enters unique order number (non-duplicate order numbers), revision number should be visible.
If he enters duplicate order number, revision number should be hidden.
Please help.
Giving you example how to achieve this.
Step 1. Create three Page Items
1) P1_ORDER_NO - Text Field
2) P1_REVISION_NO - Text Field
3) P1_ENABLE_DISABLE_REVNO - Hidden,Value Protected - No
2. Create 3 Dynamic Actions
1) Disable revision number on page load
Event - Page Load
Action - Disable
Fire When Event Result Is - True
Selection Type - Item
Item - P1_REVISION_NO
2) Check duplicate order number
Event - Change
Selection Type - Item(s)
Item(s) - P1_ORDER_NO
Condition - is not null
Action - Execute PL/SQL Code
Generate opposite false action - Unchecked
Fire When Event Result Is - True
Fire on page load - Unchecked
Stop Execution On Error - Checked
Wait for Result - Checked
PL/SQL Code -
declare
l_count number;
begin
select count(*) into l_count
from emp
where empno = :P1_ORDER_NO;
if l_count > 0 then
:P1_ENABLE_DISABLE_REVNO := 1;
else
:P1_ENABLE_DISABLE_REVNO := 0;
end if;
end;
Page Items to Submit = P1_ORDER_NO
Page Items to Return = P1_ENABLE_DISABLE_REVNO
3 ) Enable and Disable Revision Number
Event - Change
Selection Type - Item(s)
Item(s) - P1_ENABLE_DISABLE_REVNO
condition - greater than or equal to
value - 1
Action - Disable
Fire on Page Laod - Unchecked
Generate opposite false action - checked
Selection Type = Item(s)
Item(s) - P1_REVISION_NO
Hope this helps you,
Regards,
Jitendra
DER_NO -
How to add new text field in standard report
how to add new text field in standard report?
Hi,
I presume you are talking about a report display in ALV and u wish to add a column to it .
If it is a global requirement ,as in table being used there in ALV can be modified, then you can append the table and the system should pick up the same automatically from there.
Otherwise , you can make a Z program . Modify the catalog being used in ALV.
Regards,
Shweta -
How to populate the TEXT field in MIGO
Hi folks,
While creating material document in MIGO or MB01, i am inserting some data in TEXT ( Field in line item level ). This text data is disappearing , once mat doc is created.
how to populate the TEXT field in MIGO?Is there any cusomisation?it's urgent .
Regards
pabiHello Pabitra,
I had a similar issue in my Project.
Please verify if the SMOD enhancement MBCF0002 (EXIT_SAPMM07M_001) is active in your system.
If this is the case, verify from two angles:
a) Whether the Enhancement was accidentally activated - If yes, then De-activate the same
b) If there is some logic coded in the User Exit, but, the Text is somehow not determined...even the existing content in the text field (input to EXIT_SAPMM07M_001) will get vanished.
Hope that your problem will be resolved by this. Pls reward points.
With Regards
Vijay Gajavalli -
How to collapse unused text field in PDF form
Hi all, may i know how to collapse unused text field in a PDF form. Etc, we have alot of description line for user to enter the info, but some line will be left unused, so i was wondering whether can i hide those unused text field. But when i need them, i just expand it and use it.
I don't think w/o UI Customization it is possible.
UI customization won't be a small one as it is a common wizard and used at multiple places. So it will be a huge work. -
In Layout screen, how to validate i/p field?
hi,
in Layout screen at se51, how to validate i/p field?
Regards,
bb.
Edited by: BBR on Jul 24, 2008 4:23 PMHi
if u want to validate the screen fields in Module pool programming then u need to go for
CHAIN & ENDCHAIN.
Following is the example which guide u to use the chain and endchain:
In the flow logic of ur screen before the module write this code
CHAIN.
FIELD TABNAME-FIELDNAME(OR SCREEN FIELD NAME).
MODULE MODULENAME(OR FIELD NAME).
ENDCHAIN.
Double click on the module name and write ur validations.
<removed_by_moderator>
Regards
Chandu
Edited by: Julius Bussche on Aug 6, 2008 1:44 PM -
How can I expand text fields in my PDF file which I built in Forms Central?
I'm working in Windows 7 and just created my first form in Forms Central. I have many text fields that I intended for the end user to be able to type as much information in them as necessary. I selected the "multiple lines of text" setting for each of these fields. I was told by someone at Adobe a while back when I was trying to decide on learning LiveCycle Designer or using the much more user-friendly Forms Central that the form fields would not automatically expand in the PDF form, but that I would be able to click or drag on the fields manually to expand them so that, ultimately, they could be printed with all the comments, for however many pages it would take. I've exported my Forms Central form to a PDF file. However, when I type multiple lines of text in the form fields I set up to be "unlimited," I cannot get the form fields to expand. What have I done wrong? Help, please!
We are dealing with a similar situation. We have downloaded LiveCycle and created the form, but as we knew would happen, the changes that come for the content of the form are causing us to max our trial version, and as soon as the form needs a change outside of the trial time period, we are faced with the next dilemma, as Adobe doesn't offer to purchase a single license at a reasonable rate. The only reason we wanted LiveCycle was for the dynamic field feature. I plead with you to consider offering that feature in Forms Central. The other issue that we are having is that our users sometimes need to paste a table into the expandable text field. Is that even possible in Live Cycle? We don't at this point need the web-based functioning that Live Cycle offers. Thank you.
-
How to show a text field based on what is entered in a date field
Hi there LiveCycle experts!
I have a form with a text field that I want to show only if the value of the previous date field once entered is less than 1 month from today?
Any help appreciated, been researching in vain for hours!!!
SarahWow Steve - thanks so much this is so exciting I just love learning these new scripts.
I assume I need to make the text field 'Hidden' - ?
I seem to be struggling a little to get it working - are you able to have a quick squizz at my document - it is in the very early stages!
Regards,
Sarah Milne
FACEBOOK : Join our 'BritBound Social Events' Group on Facebook to receive details of forthcoming social events...click here to join.
For a sociable & stress free arrival experience!
BritBound London Office: Britain & London Visitor Centre, 1 Regent Street, London, SW1Y 4XT.
Tel UK: | 0845 450 3536 | From OS + 44 (0) 20 7808 3815
Tel OZ: | Sydney: (02) 8003 7651 | Melbourne: (03) 9005 8304 | Brisbane: (07) 3102 9766
Tel NZ: | Auckland: (09) 889 3175 | Wellington: (04) 889 2015 | Christchurch: (03) 669 2032
Website: www.britbound.co.uk
E-mail: [email protected]
Click Here to find out more about: | UK VISAS | MOBILE PHONE CONTRACTS FOR NEW ARRIVALS TO THE UK | UK ACCOMMODATION | AIRPORT TRANSFERS | UMBRELLA COMPANIES | DISCOUNTED INTERNATIONAL BANK TRANSFERS | SOCIAL EVENTS | TAX REFUNDS | NATIONAL INSURANCE (NI) NUMBERS
Disclaimer: The information contained in or attached to this message is intended only for the people it is addressed to. If you are not the intended recipient, any use, disclosure or copying of this information is unauthorised and prohibited. This information may be confidential or subject to legal privilege. BritBound cannot accept liability for any virus damage caused by this message. This documentation is for your general information, and is not to be construed as advice. Clients should not act on the information contained herein alone, and should seek independent advice if necessary.
Maybe you are looking for
-
I just installed the latest version of iTunes on my windows 8 computer. I was trying to transfer an audiobook I downloaded through overdrive media console to my iPod nano. Overdrive says it was transferred successfully, but it is not in my iPod. I
-
Quote does not print correct price
I created a price quote in VA21 for material XXXXXXX, entered the price in the sales tab & I've a price scale(VK12) for the same material under YPR0, when I print the quote the price I get is from the price scale(VK12). I'd like to print the price fr
-
Remove L01 prefix from Olap uni
HI Experts In my webi doc . i should not have L01 prefix from the olap universe. For ex: if i have L01Country from olap uni . i should only have country in webi. My issue is i can edit object properties and do it but how to do it at once when there a
-
Increasing size of the FILE VAULT - Is It Possible????
Is there any way I can increase the size of the FILE VAULT from 56GB to 150GB or more? I have a 250GB H/D. This is where my photos are store in their aperture library and because this is now full, I can't d/l any more until I either clear/delete a lo
-
hello in frame i do a dialog box and i put button in that dialog box that to close the dialog ....but i faild how can i close the dialog.....the code that i use is: import java.awt.*; import java.awt.event.*; public class DialogExample extends Frame