Javascritpt to check if data exists before entering
I have a form that users fill out..
I want the first (user_ID)field to kick off a javascript that:
1. makes it upper case while typeing (this I have working):
onKeyUp="javascript:this.value=this.value.toUpperCase();"
2. runs a select statement to see if it exists in the table, if not goto next select, if it does exist goto page 2 which pulls it in for editing..
3. runs a select that errors if its not a valid ID..
I don't want the field on a page by itself that is submitted first.. (that would obviously be the easiest solution)
I've tried creating a hidden button, and submitting that button with javascript doSubmit(HIDDEN), but I can't seen to get the onKeyUp and onChange to work at the same time
and I don't want to query the database with every keystroke..
was able to get it to work with onBlur (dont know why onChange wouldn't work)
onKeyUp="javascript:this.value=this.value.toUpperCase()" onBlur="javascript:doSubmit('HIDDEN');"
Similar Messages
-
Create a trigger to check inserted date is before or after SYSDATE
Hi,
I am trying to create a trigger that will check an inserted date against SYSDATE and alter the value (i.e. make it SYSDATE) when the entered date is incorrect.
For example, I have a Customer table with a record named MemberDate which, when a date is entered to it, will be checked by the trigger to ensure it is not before the current date.
My code so far;
CREATE OR REPLACE TRIGGER Customer
BEFORE INSERT ON
Customer
FOR EACH ROW
DECLARE
e_invaliddate_ud EXCEPTION;
BEGIN
IF :NEW.MemberDate < SYSDATE THEN
RAISE e_invaliddate_ud;
END IF;
EXCEPTION
WHEN e_invaliddate_ud THEN
DBMS_OUTPUT.PUT_LINE('The date entered for MemberDate is invalid. The
MemberDate has been set to the current date');
END;
So far, this trigger only returns an error message but allows the date to be entered even if it is incorrect. I have tried a few ways of altering the entered date to SYSDATE but to no avail.
I am running scripts using SQL PLUS and inserting data using
INSERT INTO Customer
VALUES(CustomerID, ..., MemberDate);
Where the values entered will be checked to ensure the MemberDate is not before SYSDATE.
The MemberDate data-type is DATE and has a rule that it must not be before the current date. I am aware that a constraint may not be used to perform a check using SYSDATE, this is why I am trying to make a trigger.
However, my knowledge of triggers is limited
If anyone can help, I will be very Happy.
Thank you in advance.Use this if you want an error message that halts the execution:
create or replace trigger customer
before insert on customer
for each row
begin
if :new.memberdate < sysdate
then
raise_application_error(-20000,'The date entered for MemberDate is invalid.');
end if;
end;Use this if you want to automatically to overwrite the MemberDate with sysdate without an error message:
create or replace trigger customer
before insert on customer
for each row
begin
:new.memberdate := greatest(sysdate,:new.memberdate);
end;Note: untested
Regards,
Rob. -
Checking whether data exists in a BLOB type database column in Forms 6i
I am developing an application regarding inventory of a plant's spare parts. I am storing photo (.bmp) of spares in the database in a column of BLOB type. Once user punches spare's code, form displays spares data on screen using EXECUTE_QUERY. At this stage I want to check whether picture (.bmp) data was found in BLOB type database column or not. I want to take action accordingly. How to check this. If it would be a numeric column, I would have checked NULL but NULL does not work with BLOB type coloumns.
Pl. help.
Thanks in anticipation.Did you look in the database documentation? The DBMS_LOB package has the method you need: getlength().
This was more of a database question than a Forms question, so you'd probably have more luck with these types of questions on one of the other forums, like the database or SQL forums.
Regards,
Robin Zimmermann
Forms Product Management -
Trigger that checks if value exists in another table before insert
Hi,
Can any one help me with the correct code.
I am trying to write a trigger that checks if the new value (:new.T1) does not exist in another table (T2) before entering it (in T1).
Create or replace trigger T1
BEFORE
insert on T1
for each row
Declare
x Number;
begin
SELECT Count (*) INTO x
From T2 WHERE T2.Col1 = :new.T1;
IF (x > 1 or x = 1) Then
DBMS_OUTPUT.PUT_LINE('This value has been used before try another one.');
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT INTO T2 (Col1) values (:new.T1);
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE('This value has been used before try another one.');
end;I think this question is suitable for the SQL and PL/SQL forum.
-
User exit for checking Actual dates before TECO of WBS element
Hi,
Is there a user exit in PS we can use that checks to see if Actual dates have been entered on the WBS element before the WBS element is set to TECO?Hi,
I am not sure on this as i havent checked it. You can explore and check if defining validations can serve your purpose.
Best Regards,
Gokul -
File Adapter - Check file exist before performing read
Is there a feature in the file adapter or invoke activity for SOA 11.1.1.5 that performs a check to see if a specific file exists before it performs a read function? If file does not exist then move onto to next step, if it does then read it.
I am trying to do this in 1 step instead of performing a listing of the directory first before perfomring the read.Hi,
When you read a file, using the synchronous read file, you have to point to a file (file name, directory...). That way, when you are executing the invoke activity, followed by a FileAdapter, it's either the file exists, and you read it, or it's not exist and you don't read it.
Arik -
Checking table columns and data type before inserting
I have some data coming from different sources and want to insert the data from those files into multiple tables.
Before inserting the data I like to perform a check on data type, length, null etc so that I can avoid errors at the time of insert. If there is any problem with the data then I do not want to perform the insert and report the problems.
ThanksIf you have 10gR2 (10.2.0.4) you could use DML_ERROR_LOGGING.
Read about it here, see the examples: http://tkyte.blogspot.com/2005/07/how-cool-is-this.html
In short: it avoids errors during your transactions, afterwards you know which records failed and why.
It's more or less the same functionality:
your goal:
check before transactions and avoid the insert of 'bad' records. (extra code, extra maintenance, more chance of bugs)
dml_err_logging:
insert 'bad' records during transaction automatically into a dedicated error table including error message.
Edited by: hoek on Mar 24, 2009 6:56 PM -
Checking the master data automatically before the payroll run...
Hi Friends,
Can anyone tell me that, is it possible to check the master data automatically before the payroll run.
If any user forget to maintain any important info-type ( like Cost Distribution ) in time of master data maintenance, SAP allow the Payroll system to run the payroll for that employee. Only in time of account posting the user is able to know the problem and due to rectify the problem they have to delete the payroll.
So, I therefore wants to know that is there any check point or can customized any such things, which will check the necessary info-types before running payroll and generate an error massage about the missing info-type and also skip the processing for that person.
With regards,
Diptenduhave
a look at this report
but before that make sure wht are the mandatory infotypes that are maintained to the employee so that u can come to an idea what are infotypes that are maintained for the memployee
se 38 HTWLINFO read the documentation of the is report mmight be useful -
Hi Experts
I had a requirement for the Query, when we executing the through slection screen we will be giving 0fiscyear "from and to" dates. the "Valid to" (0date) has to check the relation of the Client partner and contract of relationship, if it is within the current date it should dipslay the report with values , if it is out of current date, it should display in the report as "null".
Logic : This report is based on the u201CClient Partneru201D and the u201CContact ofu201D relationship. If any of these relationships have a u201CValid Tou201D
date set before the date that the report is run u2013 print u201Cnullu201D.
Could anyone of you provide the inputs on this.
Thanks in advance
Thanks
Sekhar.PIvanLevo wrote:
Could not find the /Library/Startup Items.
Good, it shouldn't be there.
For your Dock problem,
Go to your Finder "Go" menu choose "Go to Folder" and enter ~/Library/Preferences. Then delete these files then restart or log out and back in.
com.apple.Finder.plist
com.apple.dock.plist
com.apple.dock.db
com.apple.dock.extra.plist
Let us know -
hi all, how can i check the booking exist or not before add booking??thanks
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:booking");
PreparedStatement pstat = con.prepareStatement("insert into booking values(?,?,?,?,?,?,?,?)");
memberno = tf1.getText();
pstat.setString(1,memberno);
facilityno= ch1.getSelectedItem();
pstat.setString(2,facilityno);
date = ch2.getSelectedItem();
pstat.setString(3,date);
time = ch3.getSelectedItem();
pstat.setString(4,time);
int no1 = (int) (Math.random()*10000);
String referenceno = String.valueOf(no1);
tf2.setText(referenceno);
pstat.setString(5,referenceno);
pstat.setString(6,"accepted");
collectiondate = date;
tf3.setText(collectiondate);
pstat.setString(7,collectiondate);
collectiontime = time;
tf4.setText(collectiontime);
pstat.setString(8,collectiontime);
pstat.executeUpdate();
tf1.setText("");
pstat.close();
con.close();
[\code]2 errors,
method getSelectedItem(int), location:interface java.sql.ResultSet
String date1 = String.valueOf(rs.getSelectedItem(1));
method getSelectedItem(int), location:interface java.sql.ResultSet
String time1 = String.valueOf(rs.getSelectedItem(2));
thanks
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:booking");
PreparedStatement ps = con.prepareStatement("select date, time from booking where date = ? and time = ?");
ps.setString(1,ch2.getSelectedItem());
ps.setString(2,ch3.getSelectedItem());
ResultSet rs = ps.executeQuery();
while (rs.next()){
String date1 = String.valueOf(rs.getSelectedItem(1));
String time1 = String.valueOf(rs.getSelectedItem(2));
if (date.equals(date1) && time.equals(time1)){
JOptionPane.showMessageDialog(this,"booked.");
booking bk = new booking();
bk.setVisible(true);
rs.close();
ps.close();
[\code] -
Procedure to create date row if it doesn't exist fails if 1 date exists
Hola -
The idea is to create a procedure which checks if today's date exists in the table, and if not enters it. Works fine if there is only 1 date that matches but bails if it doesn't with the error:
ORA-06512: at line 1
01422. 00000 - "exact fetch returns more than requested number of rows"
and I'm not sure why. Any help (or alternate way to work this) greatly appreciated. 10gR2 right now but 11g is an option.
Procedure:
create or replace
PROCEDURE "ADD_DAY_FOR_REFDESK_STATS" IS
v_date_exists varchar2(1) := 'N';
BEGIN
select 'Y' into v_date_exists
from dt
where to_date(thedate, 'DD-Mon-YYYY') in
(select unique(to_date(sysdate, 'DD-Mon-YYYY')) from dt);
if v_date_exists = 'Y' then
insert into dt (thedate, col) values (sysdate, 'col1');
end if;
END;
Test table:
CREATE TABLE "SUPERVISOR"."DT"
"THEDATE" DATE,
"COL" VARCHAR2(20 BYTE)
Data:
insert into dt (thedate, col)
values (to_date(sysdate, 'DD-Mon-YYYY'), 'Col1');
insert into dt (thedate, col)
values (to_date(sysdate, 'DD-Mon-YYYY'), 'Col2');Hi,
GuyInPhilly wrote:
Many thanks Frank, I am fuzzy on MERGE so I had avoided it, but it works, my great thanks & also for the explanation. MERGE is very handy. If it takes some time to learn how to use it, I'm sure you'll find it time well spent.
I had assumed my call of unique would have taken care of this.UNIQUE means that the query won't return two identical rows; "SELECT UNIQUE job FROM scott.emp" returns 5 rows. Also, you were using UNIQUE in a sub-query. It's okay for the sub-query to return multiple rows; SELECT ... INTO requires that main query returns no more than 1 row. (By the way, it doesn't matter if the rows in an IN-subquery are unique or not.)
I actually do have to enter several dates but they remain the same; what varies is the value for 'col', there are 10 of them entered for each date. Usually, I use 'INSERT ALL' as in:
INSERT ALL
INTO dst (dst.thedate, dst.col) VALUES (src.todays_date, 'colA')
INTO dst (dst.thedate, dst.col) VALUES (src.todays_date, 'colB')
INTO dst (dst.thedate, dst.col) VALUES (src.todays_date, 'colC')
SELECT * FROM dual;
which works on it's own, but in this case/in the context of the MERGE I am getting the error:
SQL Error: ORA-00926: missing VALUES keyword
I'll assume that construct isn't valid in this case, what would be a good way to accomplish this?
As for using 'to_date' on a date field.... I blame a recent switch to tea instead of coffee.I don't think you can usie INSERT ALL with MERGE.
You can generate a source table with 10 rows, lile this:
MERGE INTO dt dst
USING (
SELECT TRUNC (SYSDATE) AS todays_date
, 'Col' || CHR (64 + LEVEL) -- or use CASE to get 10 distinct values
AS col
FROM dual
CONNECT BY LEVEL <= 10
) src
ON ( src.todays_date = dst.thedate
AND src.col = dst.col
WHEN NOT MATCHED
THEN INSERT (dst.thedate, dst.col)
VALUES (src.todays_date, src.col)
; -
No data Exists for this selection in PSA.
Hi Guys,
I received an Error message with loading of 2lis_03_bf datasource..
Error message when processing in the Business Warehouse
Diagnosis
An error occurred in the SAP BW when processing the data. The error is documented in an error message.
System response
A caller 01, 02 or equal to or greater than 20 contains an error meesage.
Further analysis:
The error message(s) was (were) sent by:
PSA Table
DETAILS Tab: Processing (data packet): Errors occurred
: Data Package 6 ( ? Records ) : Errors occurred
: Update PSA ( 0 Records posted ) : Errors occurred
: No data exists for this selection in PSA
For DataPacket 6 (Records sent :21572 - Records Received : 0)
All other datapackets are updated fine with almost 10,00,000 records..Any help on this ,guys..
Manythanks
ArunHi,
While the load was in progress some one might have deleted the data in PSA or there might be a PSA deletion job running or there might be a PSA deletion chiain which includes this table. Check all these to find out how it got deleted.
In order to load the data again you can do a reload and probably it works fine this time.
Anup. -
No organizational data exists on item level (error message)
Hello everybody,
I still have this error message when try to create a shopping cart : 'No organizational data exists on item level'
Following a lengthy discussion with SAP Support, SAP recommended that I remove the reference of the Purchasing Organization and Purchasing Group to the backend system (R/3).
After removing the reference I was able to complete the SC creation process, but I got an error at the PO creation process, where I am unable to release the PO since it is not linked to a backend (R/3) Purchasing Organization/Group.
I am currently using SRM 4.0 with EBP 5.0 in Extended Classic Scenario.
I need an Urgent help on this issue !!
Thanks,
LinaHi,
If You have own PO document type (ZCS) then don't hange it.
in SYS attrib add a local EBP system
If you don't use local categories, You don't need to add product cat. * for local system.
in my ppoma_bbp company have two purch orgs.
-for local (fields with purch org and system id is empty)
-for backend (fields with purch org is filled from backend system.)
Example:
Company (function with company code PW01\R3100)
- Purch org local (function purch. org. checked but not filled)
- Purch group local (function purch. group checked bud not filled)
- Purch org backend (function purch. org. checked with values PZ1\R3100)
- Purch group backend (function purch. group checked with values PZZ\R3100)
Regards,
Marcin Gajewski -
Hi experts
when i am entering RRMX tcode. i am getting error message at status bar as " No log data exists"
Please help me out. What could be reson and how can i reslove it
thanks
pavanHi
i am using SAP GUI at client place via Citrix.
it was working fine till yesterday
pls suggest. wat could be other possible reason
thanks -
Check for required fields before locking subforms and submitting
Hello,
I have a 5-page form with many questions, to be completed by the original requestor and multiple approvers. What I'm trying to do is have the original requestor's Submit button on p. 3 lock the input on the first three pages, but first check if all those fields have some content. I currently have all the fields on pp. 1-3 set to "Required" in the object properties, but my script still locks them when there's is one empty one. Here's what I have:
//Lock portions of form
Page1.access = "readOnly"
Page2.access = "readOnly"
Page3.access = "readOnly"
//Save document, allow user to change name
app.execMenuItem("SaveAs");
//Submit via e-mail
Submit_REAL.event__click.submit.target = "mailto:[email protected]" +
"?subject=Subject text" +
"&body=Message";
Submit_REAL.execEvent("click");
The automatic check for required fields happens after the pages get locked. I would like the check to stop the process before it locks the pages. Is there any way to check all at once that all "Required" fields on those pages have some content before allowing the script to proceed? I know how to script it to manually check the 50 or so questions on those pages, but I would like to avoid that. Thanks for any help.There are a few problems that I can see from the start. First, your code is going to pick up EVERY node that exists on these pages. Some of those nodes will not have a rawValue, and some will not have an actual name. As an example, you can take your code and create a text field to dump all of the names of the nodes that you get when you pull in all of the nodes this way. Here's an example:
The result:
Now, the question is, do you have a consistent naming convention for your fields that might be empty? That could be text fields, radio button lists, etc. For instance, I always prefix the names of objects in order to more easily keep track of what they are in scripts. Since I'm doing that, I can check the name of the field for tf, nf, rbl, cb, or whatever I have included to make sure that I'm checking an actual field before I check for things like rawValue.
var nodeName = oNodes.item(nNodeCount).name;
if (nodeName.indexOf("tf")>-1 || nodeName.indexOf("rbl") > -1 || /*check other field types*/) {
//insert your code to check for empty answers here
As for your line 7 issue. The syntax problem is that you've put extra parentheses in your if statement. Take out the parentheses that are just before and after the or "||".
*This is my fourth attempt to reply. Something was going on with Adobe/Jive earlier, I suppose.
Maybe you are looking for
-
HEATING OF THE BATTERY AND PHONE
I am usig a nokia 6233 it gets heated up excessively when ever i put it on charging the whole phone and the battery gets heated up please any one do help me and say what to do ...
-
Oracle taking 100% CPU usage
Hi, I have a situation. I am trying to execute a big query by involving 3 tables (joins). The query is taking about 20 minutes time to execute. While the query is executing the CPU usage for ORACLE is 100%. Please put somelight on this as of to why t
-
On my Bank of America Billpay I get an error when trying to see a pdf of a bill in Firefox 4
With the new version of Firefox I am unable to open pdf ebills on the Bank of America site. I had no problem on earlier versions. There is no problem on Explorer opening the pdf.
-
And suddenly my computer ost my iPhoto and budy photo libraries. Empty.Help
Operating system OSX 10.9.4 My lap top has had no problem till date. I tried to open the iPhoto and it was empty of photos. I then tried the buddyPhoto and that too showed no pictures.. I did not know what to do but coming to this forum for help. HE
-
Imported MPEG-4 clips to iMovie08 arrive without audio
I've recently shot a number of video clips with my Sony Cyber-shot digital camera and imported the stills and video clips to iPhoto. I've just upgraded to iLive08 and have attempted to import the MPEG-4 clips from iPhoto into iMovie. The clips arrive