How to handle user entered data validation
Hi,
In my page i have three fields
Empname (String)
Empnumber (Number)
DOB (Date)
These fields are mapped to VO which are mapped to EO.
When user enters string in Empnumber field then it will throw user following Error "Cannot create an object of type:oracle.jbo.domain.Number with value hghfg"
I want to display above Error in user friendly fashion.
Where to do this and How to do this?
And i have one more question
can we handle all the exceptions in seter method of EOIMPL?
-Thanks
Mithun
Sumit,
I have set 'Disable Client Side Validation' in the property inspector true for submit button. Added below code for validation
In CO
String lb_flag= (String)am.invokeMethod("validateRVSize",prm1,prmType1);
In AM
public String validateRVSize(String val)
String values = "1234567890' ";
for (int i=0; i < val.length(); i++)
if (values.indexOf(val.charAt(i)) < 0)
return "false";
return "true";
but what i have observed is control is not at all coming to process form request. it is doing it's validation in processformdata itself, i suppose.
because no statement is getting printed if i had entered characters in number field.
-Mithun
Similar Messages
-
How to use User entered dates in intreval
Hi,
User will enter date range in variable
As per my requirment i want to use no of days between those 2 user entered dates in my calculaction
How can i achieve this at report level.
ThanksHi
Create a variable with intreval.
There is a function module which calculates the no of days between the days
Go to SE38 and ZXRSRU01 Program
Write the Code like this (Not exact code) you can modify
WHEN "ZZZZZ"(Before that create a formula variable to get the number of days between the days and use the tech name of the formula variable here)
read ..the lower limit and the upper limit of the caldaz variable
FROMDATE = L_S_RANGE-low
TODATE = L_S_RANGE-HIGH
Then call the function module
Search for the function module by using days in SE37
Then pass the from and to Date to the function module it will retun the number of days
update that to table e_T_Range
You can proceed with this
Regards
M.A -
How can a user enter data as many it was specified for??
I am writing a program that makes calculations on data entered by the user. First I ask the user how many inputs he/she wants. And my problem is how the user can enter as many input he/she asked for. How do I make the program ask for input more than once, before I do calculation on the entered data???
I am sorry if my english is hard to understand, but I hope this was understandable.I think you should use a readInt() if you have such a method in your Keyboard class to ask for the numbers.
Then create a float array with that many elements, and use the for-loop you have shown:
for (...) {
numbers[ i-1 ] = Keyboard.readFloat(); // numbers is a float array
// if you let i go from 0 to i < tall, then you don't need to subtract 1 from i.
} -
How to compare user entered date with current date
Hi all
my requirement is, user allowed select one date, in code i have compare this date with current day date. it should be 15days gap other wise display error message.
I am worried about how to get current date in code. Is there any code to get current date. please reply me with code or mail me at [email protected]
Thanx
keerthiKeerthi,
Use the method <b>getDifference()</b> of the DateHelper.java available here.<a href="http://www.koders.com/java/fid14A61FEB1B45A64E42E1DCAD7070B46AE46340BA.aspx">DateHelper</a>
1. Create a new folder, say Util under your src folder. (com.xyz.util)
2. Put this DateHelper.java file in that folder,(com.xyz.util) .
3. Now, write an import statement for this java class in the required view.
4. Use the getDifference() method of this class to the difference in days between two days.
Or
Simply use this code.
// Get msec from each, and subtract.
long diff = currDate.getTime() - selectedDate.getTime();
int noOfDays = diff / (1000 * 60 * 60 * 24);
where currDate is today's Date and selectedDate is the Date selected by the User.
Bala -
How to get the user entered data?
Hi all,
I have created an HTMLB DynPage component.
In That i have created my input screen with textboxes using response.write method.
i have added one onConfirm event on which the data whould validate.
so onConfirm method im trying to get the data with request.getParameter method which returns null...
how to do...how to get the user entered data to do my validations...can anyone plz advice.
Thanks,
ViswesHi
inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
to create portal input field (ie HTMLB), you should do something like
this in the doProcessBeforeOutput member function
InputField field1 = new InputField("Id1");
field1.setSize(8); // 8 characters
this.getForm().addComponent(field1);
and in doProcessAfterInput member function
InputField field1 =
(InputField) this.getComponentByName("Id1");
you can then manipulate the content of the field.
Hope this help,
Guillaume -
How to populate date & time when user enter data for custom table in sm30
Can anyone tell me How to populate system date & time when user enter data for custom table in sm30..
Req is
i have custom table and using sm30 user can enter data.
after saving date i want to update date & time in table
Pls let me know where to write the code?
Thanks in AdvanceYou have to write the code in EVENT 01 in SE54 transaction. Go to SE54, enter your Ztable name and in the menu 'Environment-->Events'. Press 'ENTER' to go past the popup message. In the next screen, click on 'New Entries'. In the first column, enter 01 and in the next column give some name for your routine(say UPDATE_USER_DATE_TIME). Then click on the souce code icon that appears in blue at the end of the row. In the code, you need logic like below.
FORM update_user_date_time.
DATA: f_index LIKE sy-tabix.
DATA: BEGIN OF l_total.
INCLUDE STRUCTURE zztable.
INCLUDE STRUCTURE vimtbflags.
DATA END OF l_total.
DATA: s_record TYPE zztable.
LOOP AT total INTO l_total.
IF l_total-vim_action = aendern OR
l_total-vim_action = neuer_eintrag.
MOVE-CORRESPONDING l_total TO s_record.
s_record-zz_user = sy-uname.
s_record-zz_date = sy-datum.
s_record-zz_time = sy-uzeit.
READ TABLE extract WITH KEY l_total.
IF sy-subrc EQ 0.
f_index = sy-tabix.
ELSE.
CLEAR f_index.
ENDIF.
MOVE-CORRESPONDING s_record TO l_total.
MODIFY total FROM l_total.
CHECK f_index GT 0.
MODIFY extract INDEX f_index FROM l_total.
ENDIF.
ENDLOOP.
ENDFORM. " UPDATE_USER_DATE_TIME
Here ZZTABLE is the Z table and ZZ_USER, ZZ_DATE, and ZZ_TIME are the fields that are updated. -
How to know whether entered date is SAPdate format or User dateformat.
Hi all,
I am uploading data from SAP to internal table ,
here I need to do below logic ,
If user entered SAP dateformat in excel , no need to convert after uploading.
elseIf user entered user default need to convert to SAP date format.
If user entered in other foramt.
need to give error.
so , how to know whether entered data is in SAP format or not.
Regards,
vineshTry this logic
IF call fm DATE_CHECK_PLAUSIBILITY = true
"date etered in SAP internal format
ELSE if call fm CONVERT_DATE_TO_INTERNAL = true
"date entered in user format
else.
"incorrect format
endif.
Regards
Marcin -
How can I read the last cell of a JTable that a user Enters data
I have a one column JTable with several rows that a user enters data to. Upon entering the last data, the user clicks a button to read all the data from the rows in the JTable and puts them in an arraylist. If the user does not click enter or navigates away from the last cell, then after clicking the button it does not read the last cell entered. Since the user is clicking on a button to indicate he is done entering data on the table, does he also have to hit the enter key to indicate he is done entering the data?
The code below is my tablemodelListener:
public class InteractiveTableModelListener implements TableModelListener {
public void tableChanged(TableModelEvent evt) {
if (evt.getType() == TableModelEvent.UPDATE) {
int row = evt.getFirstRow();
System.out.println("Update row:"+" "+row);
jTable1.setRowSelectionInterval(row, row);
}Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
In the future, Swing related questions should be posted in the Swing fourm. (This question has been asked and answered dozens of times).
But there is not need to repost because [Table Stop Editing|http://www.camick.com/java/blog.html?name=table-stop-editing] explains whats happening and give a couple of solutions. -
Cell data not getting refreshed in which user enters data OO ALV(editable)
Hi Friends,
I am using OO ALV for editable grid display.
I am unable to change grid data in the cell in which user enters something, using OO ALV. Did through debugging of my own program and found that some problem with system program. Then I did all system debugging. Could not find out why is the grid not getting refreshed with the new data in the cell in which user had entered some value. Rest of the cell's data are getting refreshed with the values which i am updating in the final internal table. I can see that the data in the final internal table is changed for the cell in which user enters data. But even after the call of
CALL METHOD obj_alvgrid1->refresh_table_display
does not refreshes the data in the cell in which user had entered data. Rest of the cells data are getting refreshed.
Piece of code:
SET HANDLER obj_event_receiver->handle_data_changed
FOR obj_alvgrid1.
METHODS: handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed
e_onf4
e_onf4_before
e_onf4_after.
METHOD handle_data_changed.
DATA : v_valid TYPE char1,
v_refresh TYPE char1.
*--check mt_good_cells semantically
CALL METHOD perform_semantic_checks( er_data_changed ).
*--If PBO is again visited, just refresh the ALV grid.
CALL METHOD obj_alvgrid1->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDMETHOD.
METHOD perform_semantic_checks.
LOOP AT er_data_changed->mt_good_cells INTO w_good.
v_index = sy-tabix.
CASE w_good-fieldname.
WHEN 'ZASCAS'.
*Now here based on some conditions I am changing my final internal table i_zamtsmatnp
MODIFY i_zamtsmatnp FROM w_zamtsmatnp INDEX
w_good-row_id TRANSPORTING
zascas modif.
User enters data in zascas field. Based on the data entered, I am changing other fields which is getting refreshed. I am also changing zascas in the program even after user had already entered the value which was bit wrong and i am correcting it in the program on the even "data_changed" even.
Please help me friends as i m strugling past hours wondering why the data is not getting refreshed for the cell in which user enter data.
Regards,
SuryaHi Surya,
The approach you are following is correct. You need to use the comibnation of all these things:
Event - DATA_CHANGED
Methods - CHECK_CHANGED_DATA
- GET_CHANGED_DATA.
However, here are few standard programs which are having similar functionality.
BCALV_EDIT_03
BCALV_EDIT_07
Check out these once.
Note: If anything is helpful, dont forget to reward points
Thanks,
Adithya K
SAP Practise
[email protected] -
How to handle user exits while using BAPI
HI experts can any one help me on how to handle user exits while using BAPI. Do we need to handle it explicitly or standard BAPI will take care of it??.
Regards,
Hari KrishnaIf you have added some fields using append structures for screen enhancements, then you have to use appropriate user exits to fill these data while calling BAPI. Some BAPIs have EXTENSION structures to fill the custom data which can be processed using user exists or enhancements.
Regards
Vinod -
Display of user entered date in one column
Hi Guys,
Is it possible to display user entered date(any date) in column of all rows?
I need to calculate no of days(User entered date-Deposit date).
Please give some input.Hi Sagar,
How can u display user enterd date in a column?
For example if user entered 31.03.2007 as input,i need the same date(31.03.2007 ) to display in all rows of the column,so i can use it in the formula.
Thanks. -
To compare two user entered dates
HI FRIENDS
here is my code. When i try to print the user entered date (dd/MM/yyyy)(which i am storing in a string) the program dispalys nothing. and everey time i enter a valid date it displas "invalid From date entered ". I need to store the user entered date into a string because i need that for further use. All my intesion is to get two dates from user in dd/MM/yyyy. Strore them in certain variable. Check if they are valid or not. and make sure todate is either equal or greater than fromdate. Please help me to solve this problem.
public class EDTDateValidation extends JFrame implements ActionListener{
private JLabel fromlabel;
private JLabel tolabel;
private JTextField fromtxt;
private JTextField totxt;
private String fmt ="dd/MM/yyyy";
private java.lang.String fromdate;
private java.lang.String todate;
private JButton buttonOK;
private JButton buttonCancel;
private Date theDate;
private Date date1;
private Date date2;
private JPanel mainPanel;
SimpleDateFormat dtformat = new SimpleDateFormat(fmt);
public EDTDateValidation(){
super("Date Validation");
dtformat.setLenient(false);
mainPanel=new JPanel();
mainPanel.setLayout(null);
fromlabel = new JLabel("From Date");
tolabel = new JLabel("To Date");
buttonOK = new JButton("OK");
buttonCancel = new JButton("Cancel");
fromdate = new String();
todate = new String();
fromtxt = new JTextField(10);
totxt = new JTextField(10);
fromdate = fromtxt.getText();
todate = totxt.getText();
mainPanel.add(fromlabel);
fromlabel.setBounds(20,20,50,15);
mainPanel.add(tolabel);
tolabel.setBounds(20,50,50,15);
mainPanel.add(fromtxt);
fromtxt.setBounds(90,20,130,20);
mainPanel.add(totxt);
totxt. setBounds(90,50,130,20);
mainPanel.add(buttonOK);
buttonOK.setBounds(70,80,71,23);
mainPanel.add(buttonCancel);
buttonCancel.setBounds(150,80,71,23);
buttonOK.addActionListener(this);
buttonCancel.addActionListener(this);
setContentPane(mainPanel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(247,140);
setResizable(false);
//pack();
public static void main(String args[]) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
catch(Exception e) {
System.err.println("Could not load Look and Feel" + e);
EDTDateValidation edtDateVal = new EDTDateValidation();
edtDateVal.setVisible(true);
public void actionPerformed(ActionEvent e) {
if(e.getSource() == buttonOK){
System.out.println(fromtxt.getText());
// System.out.println(SimpleDateFormat.format(fromdate));
System.out.println(fromdate); //THIS DISPLAYS BLANK
System.out.println(todate); //THIS ASWELL
try {
Date date = null;
date = dtformat.parse(fromdate);
System.out.println("valid From date entered!");
catch(Exception f) {
System.out.println("Invalid From date entered!");
// textField1.setText("");
return;
try {
Date date = null;
date = dtformat.parse(todate);
System.out.println("valid TO date entered!");
catch(Exception f) {
System.out.println("Invalid To date entered!");
// textField1.setText("");
return;
}Judging from your code, you've got a lot of learning
to do. I suggest you
split it up:
1. Write non-GUI code that attempts to parse, compare
and format dates.
2. Write simpler GUI code to capture ordinary
strings, for example, and
worry about dates after you can do something simpler.And standard instructions: Use code tags. -
Calculate one month prior to user entered date by a Date/Time field
Hi All,
I am currently pretty new to Live cycle and have no idea about Java scripting, i have been using this site a lot for my forms and have used the FormCalc for expanding tables and so on but this one is proving difficult. I am currently designing a form that requires a calculation of one month prior to a user entered date by a Date/Time field. I have looked at multiple posts on how to do this but none have worked (they are using the Date2Num).
Is anyone able to enlighten me please?
I currently have:
Date/Time field Date Due
Date/Time field Planned Date of Review
I need Planned Date of Review to be calculated to be 30 days prior to Date Due. How do I go about doing this? Is it incorrect to use a Date/Time field as the field type for the calculation?
Cheers
BradYou can use FormCalc to compare the user input.
Put this script into the exit:Event of the date field.
if (Date2Num($.formattedValue, "MM/DD/YYYY") ne date()) then
$host.messageBox("The entered date is not todays date!")
endif -
How to handle multiple tables data in Entity Beans?
How to handle multiple tables data in Entity Beans?
i mean, my bean (non trivial) is responsible for frequent
insertion in one table and some deletion on another table.
Can anyone of you...please..?Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
Cheers,
Peter. -
How to Handle user Session in JSP
Help me,
How to handle user session in JSP.......Prakash_Pune wrote:
tell me some Debugging tech. so i can overcome from my problem.....Do you use an IDE? Any IDE ships with a decent debugger where in you can just execute the code step by step, explore the current variable values and check what exactly is happening. For example Eclipse or IntelliJ. If you don´t use an IDE, then just place some System.out.println() or Logger.debug() statements at strategic locations printing the variables of relevance so that you can track in logs what exactly is happening.
or tell any other way to find is my page is thread safe or not...Just write correct code and narrow the scope of the variables as much as possible. If you for example assigned the user object to a static variable or as a servlet´s instance variable, then exactly the same user object would be used everywhere in the application. That kind of logical things.
Maybe you are looking for
-
Videos ONLY on Facebook not playing on Macbook Pro
Hello, Videos ONLY on Facebook, will not play on my Macbook Pro. After updating my OS X to Maverick 10.9.4 I started having this problem. Here's is what I have done and NONE of it worked. -I tried using Firefox, safari and Chrome. Did not work on an
-
On certain sites (like chats), the shift symbols are not working correctly.
On certain sites (like chats), the shift symbols are not working correctly, but shift+letters works fine. I've tried changing the set keyboard language, as well as the character encoding, but nothing works. I don't have this problem in IE.
-
Firefox on my Mac is set to come on as Google but recently does not do any Google searches.
When I type something in the box and press "search" the box goes blank as if I had just opened it. No information appears.
-
Can I Install CC on More than 2 PCs?
Hi guys I run CC on a Laptop and Desktop. We're about to get a 2nd Desktop. Just so I don't banjax my account in some way, can I install CC on this 3rd machine (as a contingency) provided I'm only ever signed into CC on 2 machines at any one time? Re
-
Why do I keeping getting proxy authentication request when trying to read Gmail?
I am behind a Blue Coat proxy, whenever I try to hit gmail or google play, I get a pop-up that request user authentication (moz-proxy). I have seen a number of post on this and tried the fixes. Nothing seems to help. When I tried this: https://suppor