How do i validate ?
problem : i want to validate my input with a regex.
my input is "27/12/2005 15:41:20";
my validation regex pattern is "dd/MM/yyyy HH:mm:ss"
How do i validate ?
I did the following but i can not TRUST because of those outputs. it does not validate
String str="27/12/2005 15:41:20";
boolean tf=str.matches("dd/MM/yyyy HH:mm:ss");
System.out.println(tf); // false !
boolean tg=!str.matches("dd/MM/yyyy HH:mm:ss");
System.out.println(tg); // true !
str="27/12/2005 15:41";
boolean tk=!str.matches("dd/MM/yyyy HH:mm:ss");
System.out.println(tk); // true !Please suggest some validation trick .
Regards
it's a valid date according to that formatyes. valid date really.
i tried this also,
boolean okGood = java.util.regex.Pattern.matches("dd/MM/yyyy HH:mm:ss","27/12/2005 15:41:");
System.out.println(okGood); this too does not not work.
In fact i have this code,
some relevalt piece of code which i am using
String startTime = (String)f.get("StartTime"); // f is dyna form in Struts
// blah
ActionErrors errors = new ActionErrors();
if (startTime == null || (startTime.matches("dd/MM/yyyy HH:mm:ss"))) {
errors.add("start time", new ActionError("startTime"));
}This validation is not proper.
so, i want my user should input date only in that format , otherwise i am going to redirect him to the index.jsp page again for re-input with warning.
Similar Messages
-
How do you validate XML file against a Schema?
Are there free applications that does that?
Thanks, but how do you validata the Schema itself, which is an XML file.
I know the schema DTD is online, but still I need some utility to do it
Thanks -
How do we validate input fields on the selection screen
How do we validate input fields on the selection screen
hi balram,
u can validate input fields using <b>AT SELECTION-SCREEN</b> Event.
PARAMETERS : p_werks TYPE marc-werks.
AT SELECTION-SCREEN ON p_werks.
SELECT SINGLE *
FROM t001w
WHERE werks = p_werks.
IF sy-subrc <> 0.
MESSAGE 'Invalid Plant' TYPE 'I'.
ENDIF.
Like this, we can validate user input for plant.
check this link:
http://help.sap.com/saphelp_nw04s/helpdata/en/9f/db9a2e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
Reware me if useful......
Harimanjesh AN -
How can I validate my warranty with a refurbished iphone?
On August 28th I visited Miami and I went to the Apple Store to replace my Iphone 4 broken out of warranty with a Refurbished Iphone.
The problem is that the refurbished Iphone replacement never worked! I tried to verify my coverage status but it is out of warranty. I know that there are 90 days of warranty. However, how can I validate this warranty because the IMEI is not accepted to chat or contact Apple Support? Somebody can help me?
Thank youSILsam wrote:
I've already checked it, however the device does not have coverage. It was a refurbished iphone 4 and theoretically it has 90 days of warranty.
According to your original post, your limited warranty is scheduled to expire on November 28th. That service replacement warranty was never intended to include live support via chat or phone conversations with an AppleCare advisor. -
HOW WE CAN VALIDATE A FIELD THAT SHOULD NOT BE SPECIAL CHARACTER?
HOW WE CAN VALIDATE A FIELD THAT SHOULD NOT BE SPECIAL CHARACTER?
data : v_abcde like sy-abcde,
v_num like '0123456789',
v_data(60) type c.
start-of-selection.
v_abcde = sy-abcde.
concatenate v_abcde v_num into v_data.
if ur field co v_data
else.
message.
endif. -
How do one validate Photoshop 13. (Windows 8) Upon activation, get through to sign in screen, but when doing serial number validation, validate goes round but does not validate. Connect Later is only way out of screen. Checked account but product not listed. Installed with serial number that was sent by Adobe. Have attempted numerous times at different times of the day. On-line connection working.
Have you bothered to do any research at all? Not every app was upgrade to 5.5. Those that weren’t will next be upgraded to CS6.
Bob -
I work for Xerox and we don't get paper checks so I have no physical paystub. Everything is on file with the employer, but I also don't have a personal work email. So how do I validate to get the discount?
Can you print out your pay information? If you have access online to your paycheck info, you should be able to print out the equivalent of a "pay stub" to verify your employment with a qualified employer.
-
How i can validate a entered text against regular expressions ?
Thank you for reading my post.
how i can validate an entered text to checkk its syntax to ensure that it is a domain name ?
I think i should use RE , but i do not know how i can do this.
Thank youIf you want to validate at client side, you need to create a javascript function (validation) and add it to the "onBlur" attribute of the TextField component In the propertysheet (Set it via JavaScrip->onBlur in the property sheet). To put the Actual Java Script, you need to edit the JSP page. If you need to do it server side, create a custom validator.
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/customvalidator.html
- WInston
http://blogs.sun.com/winston -
How can I validate a date field in Portal Forms
I have a date field in portal forms that I want to perform validation on to make sure it's in the proper format before being accepted (mm/dd/yyyy). How can I validate against that field?
Hi Ben,
I took the time to test and revise. This is code that will validate a date entry (format MM/DD/YYYY). Just paste this in the "Before the start of the form..." window of the Additional PL/SQL code section of the form. Then add validateDate(); into the onBlur event window of the field in question. Replace the CYCLE_END_DATE with the field name in question.
HTP.P('
<SCRIPT LANGUAGE=javascript>
function validateDate() {
var ddObj;
var mmObj;
var yyObj;
var day;
var mon;
var year;
var field_val;
var field_name;
for (var j=0; j < document.forms[0].elements.length; j++) {
field_name = document.forms[0].elements[j].name;
field_val = document.forms[0].elements[j].value;
if (field_name.substring(field_name.indexOf(''DEFAULT.'') + 8, field_name.lastIndexOf(''.01'')) == ''CYCLE_END_DATE'') {
var delimPos = field_val.search(/\//i);
if (delimPos < 0)
alert(''Invalid date entry! Please enter in MM/DD/YYYY format. '' +
''e.g, Dec 21, 2003 would be entered as 12/21/2003'');
else
if (field_val.length != 10)
alert(''Invalid date entry! Please Please enter in MM/DD/YYYY format. '' +
''e.g, Jan 1, 2003 would be entered as 01/01/2003'');
else {
month = field_val.substring(0, field_val.indexOf(''/''));
day = field_val.substring(field_val.indexOf(''/'') + 1, field_val.lastIndexOf(''/''));
year = field_val.substring(field_val.lastIndexOf(''/'') + 1, 10);
/* Need to subtract 1 from value because in Javascript, January begins with 0
and ends with 11 for December */
month = month - 1;
ddObj = new Date(year, month, day);
mmObj = new Date(year, month, day);
yyObj = new Date(year, month, day);
if (ddObj.getDate(ddObj.setDate(day)) != day)
alert(''Invalid day!'');
if (mmObj.getMonth(mmObj.setMonth(month)) != month)
alert(''Invalid month!'');
if (mmObj.getYear(mmObj.setYear(year)) != year)
alert(''Invalid year!'');
</SCRIPT>
'); -
How can i validate the field directline under personal information of ESS?
Hi all,
How can i validate the field directline under personal information--> communication data of ESS?The thing is we don't have NWDI setup in our organization.Is there any possibility of doing it under SPRO trn.
Thanks and Regards,
samHi,
This is probably a wrong forum that you have posted your question to.
Regards,
Siddhesh -
How can i validate(compare) two date type attribute in EO.
Hi All,
jdev version 11.1.2.1.0
i have created one EO where two date type attribute ToDate and FromDate now i want to add validation rule.
which validate that difference b/w ToDate and FromDate not more than 3 month.
How can i validate this?You can create script expression
Something like
if((toDate.getTime()-fromDate.getTime())/(1000 * 60 * 60 * 24)>30)
return true;
else
return false;-Arun
P.S : Above example calculates based on number of Days (30). If you want 3 months, you need to put a logic - Simply 90 days? What about the months with 31 days and 28/29 days? etc. -
How can i validate an untouched cell and change bground color if error
Hi ,
three questions
1. I can validate data in cells in setValueAt method but the cell data will be validated only if user click on that cell.
how can i validate another cell if user does not even touch it.
2. and if error how can i change background color.
3. i have JTextField for column as cell editor/renderer. To change the data user have to double click on cell. How can I make it to click once to edit the value in the cell.
Thanks in advance for help.how can i validate another cell if user does not even touch it.
Why would you want to validate a cell if a user doesn't change it?for example user clicked Add row, and i added a row in the table with blank information...so .all cells in the new row have blanks, so if user does not enter the data in the second column... which he did not touch...i want to catch it and produce error
How can I make it to click once to edit the value in the cell.
Something like this:
DefaultCellEditor dce = (DefaultCellEditor)table.getDefaultEditor(Object.class);
dce.setClickCountToStart(3);Thank you..
Read this section from the Swing tutorial on "How to Use Tables" for more information:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html -
How can i validate input number into a Field of type char in oracle form?
hi.....
can any one help me.....please...!!!?!!
How can i validate input number into a Field of type char in oracle form?i have tried doing that, but still the field except numbersthere was an error in that code. it should have been
var_num:=to_number(var_char);however, it appears that you want the entry NOT to be a number. if this is the case then try
begin
if to_number(:block.item) = 0 then null; end if;
message('The entry cannot be numeric');
raise form_trigger_failure
exception
when value_error then
/* this is where you put the code you want to be run when the
entry is non-numeric */
end; -
hi
could any body help me
how can I validate(i.e., to make pass) a resource or a statement programmatically?
how can i see individual items from a collection?
thx in advance
pasumarthiHi pasumarthi,
I was just reading this other thread here http://qazone.empirix.com/thread.jspa?threadID=138&tstart=0 and I found it very informative -
How can I validate my XSD programatically ?
Hi,
I know how to validate XML against an XSD. But how can I validate an XSD itself? i.e Programatically press the "validate" button in XML Spy.
I have tried validating it against http://www.w3.org/2001/XMLSchema.xsd . But this does not work for imports. i,e MySchema.xsd imports CommonSchema.xsd and uses CommonSchemas element definitions.
When I validate against XMLSchema.xsd it does not check the imports.. i.e i can delete an import statement and its still valid - and in this case it obviously shouldnt be.
Anyone any ideas?
Cheers,
AlanHi Caffaine,
sounds like a difficult problem... I tried to do something similar to this a few years ago under Java 1.3, and I can tell you that you'll have a couple of problems.
1) ResourceBundles are a type of cache, so the one you load first is the one you are stuck with for the remainder of the program execution. The only ways around that AFAIK is to either author your own non-static ResourceBundle, or to have the user re-execute the client every time they want to change locales (neither of which is particularly appealing). Not sure if anything in Tiger has rectified this, but I don't think it has.
This also means that your server will be stuck in a certain locale. Probably the best thing to do would be to write your clients so that all information heading back to the server heads there in Unicode, so that you're dealing with a common encoding on the server side. This means no bytes or chars. Strings would be the thing to use.
2) AFAIK, Java has no way of programatically changing the Windows input locale. Though if I am wrong, someone please correct me!
Hope that helps!
Martin Hughes
Maybe you are looking for
-
Mid-2010 MacBook Pro and Intel 530 SSD
Hey everyone, Does anyone have any information regarding upgrading my mid-2010 MacBook Pro i5 running Mavericks with an Intel 530 250GB SSD? I have read some stories of people not being able to boot etc when running Lion with the 510/520 series. If
-
Jdeveloper 11.1.1.2.0 : Master Detail Using Fragment Error
Hi When developing a master detail solution, using a page fragment, I have encountered the following issues. I have followed forum articles and My Support solutions with success. The steps I used to create the solution is as follows; 1. Create ADF mo
-
Hi All, I have added an additional field in IT0109 through PM01. But the field is not displaying in PA30, while using infotype 0016.I have created an entry in table T582C for mp001600 and zp010900. Please let me know what could be the problem. Thanks
-
Where can I get clear instructions to clean up a mess that Ios7 has made of my data and info on my iPad. I can't delete photos, apps are missing, it's crazy and so frustrating. I have spent hours on this.
-
How can i update itunes so i can back up my phone without this popping up? i've tried to update it numerous times over the course of a couple of months but it still won't work! Please help ASAP as i need to back up my phone!