JavaScript Gurus

Hi All,
How would I use JavaScript to check the contents of a text
box/text area
when it loses the focus?
Thanks,
ATO

after the other wrote:
>>>How would I use JavaScript to check the contents
of a text box/text
>>>area when it loses the focus?
>>
>>onblur="yourCheckAlgo();"
>
>
> Hi Magoo,
>
> And what would I put into the yourCheckAlgo routine?
>
> For instance, let's say that I want to check to see
whether a certain
> person's name is in the field, but that there may be
more data in the field
> than just the name (e.g. 'Magoo is from Europe')
>
> Thanks,
>
<script type="text/javascript">
function yourCheckAlgo(formControl,listOfAcceptableNames){
var argLen=arguments.length;
for(var i=1;i<argLen;i++){
var Reg=new RegExp(arguments
,"i");
if(Reg.test(formControl.value)){return true;}
alert("Not acceptable");
formControl.focus();
return false;
</script>
<form>
<p><input type="text"
onchange= "yourCheckAlgo(this,'Tom','Dick','Harry')"
>Gents</p>
<p><input type="text"
onchange= "yourCheckAlgo(this,'Thelma','Louise')" >
Ladies</p>
</form>
Mick

Similar Messages

  • Javascript error in Safari (sequel to roll-over button problem)

    Yesterday I started a thread on non-functioning roll-over buttons in Safari.
    In the mean time (with the help of iBod) I founs out that the problem has got something to do with JavaScript.
    The problem occurs in sites I built with FreewayPro 4.0.1
    The url's:
    www.wildeplantentuinen.nl
    www.kunst-zin.nl
    The problems occur only in Safari (2.0.2 and 3.0)and not in some other browsers (even ana IE version of 2001 works great)and probably since the last Tiger Update (10.4.11)
    The JavaSriptConsole gives an "Undefined Value" error for all of the non-functioning elements on a specific line.
    Any Javascript-gurus around that could help me. (I am not a code-wizard at all).

    Thanks ra5ul,
    That (more or less) solved the problem, . . . . . . but what is going on ?
    I edited all sourcecode of numerous html-pages by hand and now they work the way they should in Safari.
    But now every time I make a small change to any page, my web-building program changes the code back to the old syntax (which, again, all browsers can read except Safari).
    Why does the problem only occur in Safari ?
    I hate to put a line on the index-pages that Mac users should not try this website in Safari.
    Problem is, I made these sites in Freeway and I don't want to upgrade that program because I switched to Dreamweaver and iWeb (for the simple ones).
    Is there a smart work-around ?

  • How to Invoke javascript fuction in processFormRequest

    Hi OAF+javascript gurus,
    Could anyone give the code for invoking a javascript function from processFormRequest of my OAF page Controller.
    The function is already added to the page by the following code in processRequest:
    String tokenFunction = " function tokenize(ccNum , line) { "+
    " alert ('ccNum:'+ccNum+'. Line:'+line); "+
    " var token = '99'+line+ccNum; "+
    " submitForm('DefaultFormName',0,{'tokenNumber':'token','lineToken':'line'} ); "+
    pageContext.putJavaScriptFunction("tokenize", tokenFunction);
    I need to call the above function from processFormRequest.
    Thanks,
    Ajmal

    Ajmal,
    I agree with Harinath, not to use javascript function with submit button, in fact even if you attach, it won't work, because the framework gives precidence to form submit and your attached javascript function will not be called. Let me explain you again , your question itself is meaningless, javascript is a browser script,So, it can only do client side validations or functions.You cannot implement javascript on a server side event.So, i hope now you understand y it cannot be used during process form request.
    I gave given you solution of your problem, in my previous reply. By "Handle", I mean get the messagetextinput bean in process request and attact a javascript function using onChange method.
    I hope i am clear.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Calculating Previous Month(s) From Current Date

    Greeting JavaScripting Gurus!
    I would like to ask for some assistance on Date Calculation.
    Here is my current scenario:
    The user inputs a date mm/dd/yyyy ("DateField")
    The powers that be over here are asking for the "DateField" to then calculate these items:
    "DateField" minus(-) 12 months = mm/yyyy ("12MonthsAgoDateField")
    "DateField" minus(-) 18months = mm/yyyy ("18MonthsAgoDateField")
    "DateField" minus(-) 36 months = mm/yyyy ("36MonthsAgoDateField")
    and so on...
    I've read some of the Date Calculation posts, but could no seem to find anything that fit this scenario.
    I freely confess my javascripting ability is very minor.
    I would greatly appreciate any help in scripting this.
    Thank you!

    Unfortunately the numbers of days in a month or year are not the same for all months or years, so the get and set date methods might not work. Fortunately there are the getMonth() and setFullYear() methods for getting or setting the month or year for a given date.
    For the "On Blur" action for the "DateField" you can use:
    function GetField(cName) {
    // get a field object with error catching;
    var oField = this.getField(cName);
    if(oField ==  null) app.alert("Error accessing field named: " + cName, 0, 0);
    return oField;
    } // end GetField function;
    function AddMonths(oDate, nMonths) {
    // add nMonths to oDate object;
    oDate.setMonth(oDate.getMonth() + nMonths);
    return oDate; // return adjusted date object;
    } // end AddMonths;
    function Scand(cFormat, cDate) {
    var oDate = util.scand(cDateFormat, event.value);
    if(oDate == null) app.alert("Error converting " + oDate.valueAsString + " with format: " + cDateFormat, 0, 0);
    return oDate;
    } // end Scand functon;
    var cDateFormat = "mm/dd/yyyy"; // format for date strings;
    // event value is the start date string;
    // 12 months ago;
    var o12MonthsAgo = GetField("12MothsAgoDateField")
    var oDate = Scand(cDateFormat, event.value);
    oDate = AddMonths(oDate, -12) // subtract 12 months;
    o12MonthsAgo.value = util.printd(cDateFormat,oDate);
    // 18 months ago;
    var o18MonthsAgo = GetField("18MothsAgoDateField")
    oDate = Scand(cDateFormat, event.value);
    oDate = AddMonths(oDate, -18) // subtract 18 months;
    o18MonthsAgo.value = util.printd(cDateFormat, oDate);
    // 36 months ago;
    var o36MonthsAgo = GetField("36MothsAgoDateField")
    oDate = Scand(cDateFormat, event.value);
    oDate = AddMonths(oDate, -36); // subtract 36 months;
    o36MonthsAgo.value = util.printd(cDateFormat, oDate);
    // and so on;
    Since getting a field object, converting a date string to a date object and adjusting the date object using the getMonth and setMonth methods are repeated several times I have used functions so the repeated code could be reused.

  • Change the popup window size in the "optional label with help" template?

    G'Day Apex/javascript gurus,
    I am using Apex 4.0 where I coded an HTML table for help text in one item. Now, when an user click for help in this item then the HTML table is bigger than the size of the pop up window so the client has to re size it a bit to see it fully. To fix this, I tried to create a new "optional level with help" template where I can control the size of the pop up window and make it bigger to fit my HTML table so the client does not have to resize but I could not find any parameter in the original template:
    <label for="#CURRENT_ITEM_NAME#"><span class="t9optionalwithhelp"> "javascript:popupFieldHelp('#CURRENT_ITEM_ID#','&SESSION.')" tabindex="999" that help me to achieve that
    I am not an expert in javascript but I appreciate greatly if somebody here could help me to create a new label (with help) template where I can control the size of the popup window.
    Kind regards
    Carlos
    Edited by: creyes on Aug 1, 2011 1:22 AM

    Hello Carlos,
    You can overload the APEX javascript with your own, on the page you want it to happen. You can do that in the Page Definition - Function and Global Variable Declaration.
    Copy the below code into there and change the width and height of the popup.
    function popupFieldHelp(pItemId, pSessionId){
        // Show jQuery div based dialog if not running in screen reader mode, if not fall back to old popup
        if (!$x('pScreenReaderMode')) {
            apex.jQuery.getJSON(
            'wwv_flow_item_help.show_help?p_item_id=' + pItemId + '&p_session=' + pSessionId + '&p_output_format=JSON',
            function(pData){
              var lDialog = apex.jQuery("#apex_popup_field_help");
              if (lDialog.length===0) {
                // add a new div with the retrieved page
                lDialog = apex.jQuery('<div id="apex_popup_field_help">'+pData.helpText+'</div>');
                // open created div as a dialog
                lDialog
                  .dialog({
                    title: pData.title,
                    bgiframe: true,
                    width: 500,
                    height: 350,
                    show: 'drop',
                    hide: 'drop' });
              } else {
                // replace the existing dialog and open it again
                lDialog
                  .html(pData.helpText)
                  .dialog('option', 'title', pData.title)
                  .dialog('open');
        } else {
            popupFieldHelpClassic(pItemId, pSessionId);
        return;
    }; // popupFieldHelpHope that makes sense,
    Dimitri
    http://dgielis.blogspot.com
    http://www.apex-evangelists.com

  • Capitalize the first letter after full stop.

    Since I m not a Java Programmer, my speciality is PERL. I m looking
    for a little support from any of the Javascripts Gurus here. Its
    going to take 5 or less minutes for you to solve this issue.
    I have a textbox and I want when users are typing in it. The word
    after full stop (.) will be capitalized just like MS-Word. I mean
    the begining of the new sentence with capital letter, users don't
    have to push "shift" button to capitalize the first letter after
    every full stop .
    thanks for your help.
    Any Ideas,
    Zeshan.

    Try Google. Have you heard of it? www.google.com
    do a search!

  • Safari Developer Forum?

    Can someone point me to a website or forum that I can ask a question about safari's javascript implementation? I had a look on the webkit website, but there doesn't seem to be a forum on there.
    Just in case there are any Safari javascript gurus in here, here's my problem:
    I'm trying to get the text content from a CDATA section of XML that I retreived back from an ajax request (responseXML). In Firefox I can use element.textContent and in IE I use element.text to get the contents of the CDATA section. I can't seem to find anything that will work in Safari.

    Can't help on the Java....love using it, but I'm very glad others are in charge of the programming.
    Perhaps a good place to start is .

  • OBIEE 11g: Dashboard Javascript Issue

    Hi Gurus,
    We have upgraded obiee from 10g to 11g and finding issues with javascript in a dashboard.
    Functionality: There are some custom labels showing prompt values in it with large font. When user change prompt value and Apply, it should change the value of those text as well.
    In 10g its running fine, but in 11g its not happening after we change the value of prompts. I found the following Javascript is responsible for this functionality. Even I saw one thread to suggest the exactly same code, but in 10g.
    <script type="text/javascript">
    (function(){
    var tblTag = document.getElementsByTagName('table');
    var tdElem= document.getElementsByTagName('td');
    for(m=0;m<tdElem.length;m++){
    if(tdElem[m].className=='GFPSubmit'){tdElem[m].childNodes[0].tBodies[0].rows[0].cells[0].childNodes[0].childNodes[0].innerHTML='Run Report';
    }//close if statement
    }//close for loop
    }// close function clickVal()
    </script>
    Thread:
    Change Go Button Text on Prompt Only
    I need to understand what its actually doing? and Does it really work in 11g? Whats the alternative code?
    Thanks in advance.

    In 10g these are the html objects, after upgrade you need to know the html objects for that report based on that you need to modify javascript code.
    From given code, activity is doing on these objects; You need to find out the equivalent object name for 'GFPSubmit' in 11g.
    GFPSubmit
    table
    td
    If make sense mark

  • OBIEE 11g: Dashboard not invoking simple javascript alert

    Hi Experts,
    I'm trying to invoke one simple ALERT command with javascript in obiee 11g dashboard. The purpose is when it loads, it should print one ALERT message and also when we change something in the prompt and clicking Apply button.
    Here is code written in a text item (Checked html markup option) after prompts;
    <script language="Javascript">
    alert ("Hello");
    </script>
    The Javascript alert message is showing when the dashboard page loads, but its not coming when we click the Apply button after changing the prompts.
    Can anyone give helpful hint, how to check it and why its not showing up when we press Apply button?
    Any hint or some useful links will b highly appreciated.
    Thanks in advance.

    You just used code and I would say the default event is onload of the page, thats the reason you are able to see alert.
    Since you didnt ask or written code onClick event to show alert, its not showing.
    You need to tell to browser when to prompt alert message instead of onload.
    Hope you are more confuse about 'how to do'
    if yes, mark :)
    give some more info about your actual req. that helps any other gurus to help.
    Edited by: Srini VEERAVALLI on Mar 27, 2013 8:42 AM

  • Javascript:void(null) error on clicking OBIEE prompts

    Hi Gurus,
    I have an OBIEE application with four tabs. It was working fine earlier but now when I click on any tabs in the 1st page of the application (even the "Page options" tab in the top right corner), am getting Javascript:void(null) error in the left bottom corner of the page and nothing is happening means the page is not at all navigating. I tried by disabling the pop-up blocker also, even then am getting the same error. Can anyone provide me a solution for this. Thanks in advance.

    Hi Evgeniy,
    Thanks for your reply. But that doesnt solve my issue. I cross-verified all the .js files used in the 1st page of my OBIEE application and am sure no modifications had been done in any of the .js files. Is anything else causing this issue. Kindly help. Thanks alot.

  • BSP-App not working after upgrade to Netweaver 7 / Javascript error

    Hey Gurus,
    after our upgrade the BSP Application which runs before the upgrade now displays just a plain-Design - not the Design2003 and i got Javascript errors. This results in no function whatsoever.
    Maybe someone have tipps what to look for (customizings, etc) to get this back runing?
    reg, JR

    I got the same problem but I saw in an another thread :
    BSP - non Unicode caracters - need to put an "InpuField" after a "Tray"
    Mr. bindiya have try on the same release without any problem. I sent to him an email to check.
    Regards,
    Francesco

  • Spry Validation Text Box - Playing Nicely w/ Javascript

    Greetings-
    I'm using the Spry Validation Text Fields in a registration
    form I'm designing. I really like the validation they provide.
    However, I'm trying to get them to play nicely with a password
    validation Javascript code that gets called when the form is
    submitted:
    Form Example
    The password validation JS compares the two email fields to
    make sure they are both the same. The JS is called when the form is
    submitted.
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function checkPw(form) {
    pw1 = form.password.value;
    pw2 = form.password_confirm.value;
    if (pw1 != pw2) {
    alert ("\nYour password confirmation failed. Please enter
    your passwords again.")
    return false;
    else return true;
    // End -->
    </script>
    However, this disables the Spry text field validations. I'm
    most certain my "OnSubmit" code causes the Spry validation to not
    execute.
    Any gurus have some ideas around this?
    Thank you.

    Your are going to love this...
    I confirmed I have the constructor same as yours.  Only difference in your code and mine is I did not have the validateOn blur in the Javascript, but rather was using the default validation on submission.  However, I dutifully added that, just to replicate your test exactly and to look at apples to apples.  The code is still throwing up the validation messages.
    Stumped, I took a break, played a video game, cleared the mind and started the process of carefully and logically working the code for about the umpteenth time in the last 24 hours.
    Given this validation is working just fine on the page where new items are created, I laid out that pages code next to the edit page code and started going through line by line... and Eureka!  No reference in my edit page head to the SpryValidationTestField.js... (**red faced, banging head on desk**)
    That's 2 for 2 with you helping me realize its not the Spry code, so it must be something else and that something else, once again, was me.  The human error element.  If I hit strike three down the road I deserve a sound verbal thrashing...
    Once again I am in your debt and you have my gratitude!
    Thank you Gramps!

  • Javascript in .jsff page

    Hi Gurus,
    Iam facing few problems in adding javascript to my .jsff page.
    i had tried with <trh:script></trh:script> but its showing not declared and dont know which lib that i need to add.
    Please let me know how to add javascript in .jsff page so when ever iam selecting a value from <af:selectOneChoice> i need to trigger the javascript function.
    Regards
    Suresh kumar

    hi ,
    Its not working.
    My use case is on selecting the value from <af:selectOneChoice> , i need to make few fields as read-only.
    i have tried by giving
    <af:selectOneChoice value="#{bindings.AprftypeId1.inputValue}"
    label="#{bindings.AprftypeId1.label}"
    required="#{bindings.AprftypeId1.hints.mandatory}"
    shortDesc="#{bindings.AprftypeId1.hints.tooltip}"
    id="soc3" clientComponent="true" >
    <f:selectItems value="#{bindings.AprftypeId1.items}"
    id="si3"/>
    <af:clientListener method="clientListenerFunction()" type="valueChange"></af:clientListener>
    </af:selectOneChoice>
    and used <af:resource> for javascript function but nothing is working.
    Is that my case cant be done in javascript.i need to use bindmethod to do ?

  • Template inclusion/Javascript issue for doc header's custom fields

    Hi all gurus,
    premise: I'm absolutely a newbie about templates and Jscript.
    I'm facing a strange behaviour for a field and I'd like to get your help on it, I'm running out of ideas.
    I modified a custom field, a checkbox, which automatically makes a second custom field active and editable.
    The logic is really simple: if the checkbox ( ZZ0LEGGE ) is checked, then the second field ( ZZ0DESCR ) is editable.
    This is managed in the template by using a Jscript function that is triggered by the event OnClick related to the checkbox.
    These two field are part of a template, say T1, which is used as an include in a pair of "main", custom templates, say T2 (additional header custom data) and T3 (document variant). These two screens are custom on an old SRM3 system.
    When working on the additional header custom data (Template T2), both buttons work fine; each time the checkbox is checked/unchecked, the screen is updated and the second field turns into active/not active as consequence.
    Working instead on the document variant screen (Template T3) leads to a wrong behaviour.
    Checking/unchecking the checkbox doesn't refresh the screen accordingly to the selection, but loads the T2 template.
    Guess there's something missing on the Javascript fuction associated with the checkbox in T1, because it will always trigger a refresh of T2, no matter the template in which it is included.
    Here are the templates:
    Template T1: [SAPLBBP_PDH_CUF 100 |http://pastebin.com/U39i5j7N]
    Template T2: [SAPLBBP_CTR_UI_ITS 9001|http://pastebin.com/3AhKRjt7]
    Template T3: [SAPLBBP_CTR_UI_ITS 9003|http://pastebin.com/4ZHtjz0r]
    The checkbox field in T1 is called ZZ0LEGGE; the "controlled" field is instead ZZ0DESC.
    Waiting for your help... thanks once again

    Ok I found an interesting starting point to focus on... I changed the simple fuction associated to the event onClick(), triggered when the checkbox is set/unset, simply using the parameters for TargetOkCode used in Template 3:
    function zOkRefresh(){
            TargetSetOkCode('`PB_OKCH.okcode`','','`bbpformname`'); //new (works for T3)
    //        TargetSetOkCode('=ZCTR_CUST1','','BBPForm');                //old one (worked for T2)
    and now the checkbox works properly in Template 3 but - obviously - stops working in Template 2.
    So it seems that zOkRefresh should dynamically decide which parameters must be used, depending on the "upper" template:
    - if the template that includes T1 is T2, then call TargetSetOkCode('=ZCTR_CUST1','','BBPForm'); if T1 is used in T3, then call TargetSetOkCode('`PB_OKCH.okcode`','','BBPForm').
    Since I'm not able to write down the script described above, can anyone help me putting that IF statement in script code? How to determine what's the "including" template in Javascript?
    Thanks again!

  • Use condition for assigning query to data provider with Javascript

    Hi gurus,
    I want to assign a query dynamically to a data provider when the user activated a Tab Panel in a Web Template (BI7).
    I can do that easily with the standard function SET_DATA_PROVIDER_PARAMETERS but this action is do each time of the activation of the Tab Panel.
    So I try to make a javascript for assign the query to the data provider only one time.
    My problem is I havenu2019t found a solution to get the default query assigning to the data provider.
    Itu2019s an example of what I try to do with javascipt :
    function Load_Query()
    var r=GET_DATA_PROVIDER PARAMETER ("QUERYVIEW_DATA_PROVIDER")
    if (r <>empty)
        executeJS_SET_DATA_PROVIDER_PARAMETERS_R()
    Thank you for help,
    Franck

    Hi Janice,
    You can check the Option Display Variable values only once.
    Thie you will the variables being displayed only once eventhough they are used in Multiple Data provider.
    If you want som variable to be data provider specific, then , you can create a new variable and add it int eh query.
    For example in your case let us say COMP1 is the variable for company code used in DP1 and DP2.
    If you want a different values to be selected for company code in DP1 and DP2 just replce the variable in DP2 with a new variabel COMP2.
    Hope this helps.
    Regards.
    Shafi.

Maybe you are looking for

  • Substitution / alternate materials in a purchase order

    Hi We have a requirement: We have in our business  substitute or alternate materials for some materials. That is  Material X can be used in place of  Y and so on.  There are atleast 3000 such materials. What we need  is a way to prompt the users whil

  • Want to share this tool I found

    Real quick, in case someone was looking for the same thing as I did (on Windows). I found this little tool that can display the current CPU and memory while AE is rendering or doing some of its stuff. I don't know how to explain or even where I got i

  • Portal Activity -- Date format in Usterstat database

    Hello, we have a problem with our activity reporting. The system shows us only 0-3 user per hour in the report. To see what's the problem we looked in our USERSTAT data base to compare it with the report. I wonder, if these numbers below are correct?

  • Urgent: Tuxedo and multiple Resource Managers

    Hello, I have a tuxedo service which updates Oracle tables and also updates queues of MQ-Series. Is it possible for this Tuxedo service to control the commit and rollback for both Oracle and MQ-Series?? Will tpbegin, tpcommit and tpabort control the

  • M4p files no good in Final Cut, how can I convert?

    A P.S. to my previous questions: The iTunes m4p files don't work in Final Cut. I can't convert them in Final Cut or Quicktime or Soundtrack or Logic Audio. In fact, they don't play in any of those apps, only iTunes. I've got the rights to a song for