Thursday, December 27, 2012

Adding ghost labels/ label in fields using JQuery to WebCenter/ ADF web application


Ghost labels is equivalent to placeholder attribute of input tag. This HTML tag is not supported by ADF. Please visit http://www.w3schools.com/html5/att_input_placeholder.asp for more on placeholder. placeholder attribute is supported in all major browsers, except Internet Explorer

Figure 1

This application covers displaying of label in fields for 3 commonly used controls, viz. Input Text, Input Text with secret="true" i.e. password and Select One Choice. Below is screenshot of ghost label image generated as output of this application
Figure 2
Once you click on any field to type, it becomes blank as shown below
Figure 3
Screen appears as below after making entries in all fields
Figure 4
Below are steps to implement ghost labels/ label in fields 
1.  Create new Web Center Portal - Framework Application
2.  Download jquery-1.7.1.min.js or get it from downloadable application under MyWebApplicationWithJQueryGhostLabels\Portal\public_html\js. Copy it to folder added by you, say C:\JDeveloper\mywork\MyWebApplicationWithJQueryGhostLabels\Portal\public_html\js
3.  Right click folder js > New > Categories > Web tier > HTML > JavaScript File, name it say, label-in-field.js. Your js folder should now be containing 2 files, viz. jquery-1.7.1.min.js, label-in-field.js
4.   Add folder, say C:\JDeveloper\mywork\MyWebApplicationWithJQueryGhostLabels\Portal\public_html\css css, in Web Content folder. Right click folder css > New > Categories > Web tier > HTML > CSS File, say label-in-field.css. Add below code to it and save it
.text-label { color: #cdcdcd; font-weight: bold;}
5.   Add below code to label-in-field.js and save it
function onADFPageLoad() {
    try {
        // Label in field/ ghost label for Select One Choice control
        $('select').each(function () {
            if (this.selectedIndex == 0) {
                $(this).addClass('text-label');
            }

            $(this).focus(function () {
                $(this).removeClass('text-label');
                $(this.options[0]).addClass('text-label');
            });

            $(this).change(function () {
                if (this.selectedIndex == 0) {
                    $(this).addClass('text-label');
                    $(this.options[0]).addClass('text-label');
                    //Use below to lines if you do not want to use CSS
                    //this.style.color = '#cdcdcd';
                    //this.style.fontWeight = 'bold';
                }
                else {
                    $(this).removeClass('text-label');
                    $(this.options[0]).addClass('text-label');
                }
            });
        });

        // Label in field/ ghost label for Input Text control
        $('input[type="text"]').each(function () {
            if (this.value == '') {
                this.value = getLabelForComponentId(this.name);
                $(this).addClass('text-label');
            }

            $(this).focus(function () {
                if (this.value == getLabelForComponentId(this.name)) {
                    this.value = '';
                    $(this).removeClass('text-label');
                }
            });

            $(this).blur(function () {
                if (this.value == '') {
                    this.value = getLabelForComponentId(this.name);
                    $(this).addClass('text-label');
                }
            });
        });

        // Label in field/ ghost label for Input Text control with secret="true" i.e. password
        $('input[type="password"]').each(function () {
            this.value = "";

            if (this.value == '') {
                this.type = "text";
                this.value = getLabelForComponentId(this.name);
                $(this).addClass('text-label');
            }

            $(this).focus(function () {
                if (this.value == getLabelForComponentId(this.name)) {
                    this.type = "password";
                    this.value = '';
                    $(this).removeClass('text-label');
                }
                else {
                    //this.type = "text"; //For testing only. DO NOT uncomment. Uncommenting will show password in plain text
                }
            });

            $(this).blur(function () {
                if (this.value == '') {
                    this.type = "text";
                    this.value = getLabelForComponentId(this.name);
                    $(this).addClass('text-label');
                }
                else {
                    this.type = "password";
                    $(this).removeClass('text-label');
                }
            });
        });
    }
    catch (err) {
        alert(err);
    }
}

function getLabelForComponentId(textId) {
    try {
        var adfComp = AdfPage.PAGE.findComponentByAbsoluteId(textId);
        return adfComp.getLabel();
    }
    catch (err) {
        alert(err);
    }
}
6.   Add say MyRegistrationForm.jspx under Web Content > oracle > webcenter > portalapp > pages, which requires to display input texts, password input texts, dropdowns to display label in field or ghost label functionality
7.   Add below lines to your MyRegistrationForm.jspx

  
  
    
      
        
        
        
      
      
        
          
          
          
            
            
            
          
        
      
      
    
  

8.   Open pages.xml from Web Content > oracle > webcenter > portalapp > pagehierarchy. Select Root. Drag drop MyRegistrationForm under Root in Page Hierarchy’s Hierarchy: section and select MyRegistrationForm. Select Delegate Security radio button under Security section. Ensure anonymous-role has View permission
9.   To run application, download it. Expand Web Content > oracle > webcenter > portalapp > pages, right click MyRegistrationForm.jspx, click run

In case, you do not wish to apply ghosting to certain controls, add below condition
if (getLabelForComponentId(this.name) != "itTelephoneNo") {}

within
$('input[type="text"]').each(function() {});

(where itTelephoneNo is id property of Input Text control on your .jspx form)

Download Application


94 comments:

  1. Hey guys if you want to play some fantastic game then visit here our homepage and play free fireboy and watergirl game online on your pc tablet and on your smartphone without any download and registration.

    ReplyDelete
  2. Are you in need of Custom Term Paper Writing Services for your various Custom Term Paper Assignment Services? Do not fret; Legitimate Custom Term Paper Writing Services is here to provide the necessary assistance you require to attain your academic aspirations.

    ReplyDelete
  3. Great post regarding ghost label and how it can be added in to JQueary and ADF application, Each and every step which is mentioned is very convenient for the user to understand and implement it. It might help Essay Writing Help UK to use this in their service also.

    ReplyDelete
  4. One approach to simplify transactions is to give everything clients need to help a given assignment inside the application itself. Since it is practically difficult to anticipate everything that law essay writing service UK clients need to finish the assignments related with their specific occupations.

    ReplyDelete


  5. After this brings up its clients get entertained well with its premium services, the Call Girls in Faridabadis liable to increase the level of fun by its quality services dissimilar to get anywhere. So, let us forget everything and take pleasure in what you wait for a long time. Check our other Services...
    Russian Escorts in Lucknow
    Russian Escorts in Mahipalpur
    Russian Escorts in Mahipalpur
    Russian Escorts in Mahipalpur
    Russian Escorts in Mahipalpur

    ReplyDelete
  6. Finding the best Help with Medical Assignment is not easy unless one is keen to establish a professional medical assignment help & medical homework help online.

    ReplyDelete
  7. It is important for medical science research paper service students to seek Medical Science Assignment Help from a reputable custom medical science writing company so as to be assured of good grades in their medical science essay writing services.

    ReplyDelete

  8. The hectic world, a usual silhouette of wrinkled-faces and lack of time & good people make absolute absence of Love in our lives. Only a smile means to exist in the whole world bringing itself a Comet of Love. So it takes you believe onRussian Escorts in Gurgaon liable to fulfill your lives with real sense of love. Check our other Services...
    Escorts Service in Gurgaon
    Female Escorts in Gurgaon
    Russian Escorts in Gurgaon
    Russian Escorts in Gurgaon
    Escorts Service in Gurgaon

    ReplyDelete
  9. Finding the best Help with Medical Assignment is not easy unless one is keen to establish a professional medical assignment help & medical homework help online.

    ReplyDelete
  10. The examples are themed for our demo web application, El Piju. ... context of a custom WebCenter Portal application, the same display ...
    Fix msvbvm50.dll error

    ReplyDelete
  11. Finally find the info someone asked the other day about Urie Brandon on celeb networth I was looking for it all over the web and luckily found it!

    ReplyDelete
  12. Hey! I am a student and I have lots of troubles with the subject you have discussed here! My major is management and marketing and I really love my studying process, courses of startup, management plan and so on, but economic statistics is my weak side, so your blog is the good find for me apart with professional writing assistance of cheap-papers where I always order different statistics and have good excel works, so if you have the same problem visit https://cheap-papers.com/excel-homework-help.php

    ReplyDelete
  13. Thank you for sharing this useful material. The information you have mentioned here will be useful. I would like to share with you all one useful source https://writer-elite.com/memo-paper/ which might be interesting for you as well.

    ReplyDelete
  14. Thanks for sharing this amazing post. I am a Writer at Assignments Planet that provides essay help uk for students in the UK. It has professional writers that will make you the best essay on any topic at a very cheap price.

    ReplyDelete
  15. WebCenter Portal, like every other programme, has static resources that the browser must cache in order to limit subsequent download access. If you want to take web content service at a cheap price you can contact us.

    ReplyDelete
  16. Very Well Explained your Blog is just amazing and provides profound knowledge. I would also like to induce your attention to masterspas for wide range of Swimming Spa Pools

    ReplyDelete
  17. Our essay checker tool has gained immense popularity among US students. If you want to be absolutely sure that your paper is perfect, then use our best essay checker tool. You have the chance now to make your paper flawless and hence impress your professor. So do not lose your chance. For the better result, you can also try essay typer tool here.

    ReplyDelete
  18. Your post is very informative. Here are all of the tech products and services reviewed by final rating. See our latest reviews or find a specific review in our archives.You can trust our in-depth technology reviews to help you buy the best product for your needs. Read our reviews to find out why click on this to see more info.

    ReplyDelete
  19. Producing immaculately written papers is not a walk in the park. Students have to juggle between many tasks at a time to keep ahead in their academic endeavors. Homework Help Websites

    ReplyDelete
  20. I'm studying information technology at the University. An article like this is so interesting for me. Writing so difficult for me and I decided to pay for a literature review and save my time for hobbies.

    ReplyDelete
  21. Students may find the assignment problem and supervisors' expectations difficult to understand or may not have time to work on the complicated requirements of the whole assignment or lack the good writing skills required to work on the assignments. We care for your skills and help you in every aspect to achieve good grades. Get Free reference generator help online that is focused on providing client satisfaction and instant gratification.

    ReplyDelete
  22. MyassignmenthelpNow, who help students globally at all academic level. We work 24*7 so that you don’t need to wait for any certain time.

    ReplyDelete
  23. Pc advisor brings you the top editorial reviews and service for daily tech products with specs, user reviews, prices and more .Professional reviews on Crypto Mining, mobile phones, laptops and more. Find complete hands-on experiences with the newest tech products on the market here. Search out all the most up-to-date reviews and, Gadgets, Latest Technology Products across the world

    ReplyDelete
  24. The InfoSecTrain Red Team Certified Training is designed to make you an influential Red Team Hacking expert who can counter cyber threats and perform effective penetration testing to detect those threats.

    https://www.infosectrain.com/courses/red-team-certification-online-training/

    ReplyDelete
  25. Hi all. It's useful for everyone and also for me too. I use writing service to prepare for my classes and it's post very informative. I'm glad to read it.

    ReplyDelete
  26. I found your post very informative. It is amazing that you provide such excellent services to students, professionals, website owners, as well as the general public.

    ReplyDelete
  27. Looking for Professional childcare assignment help? Then you are at the right place. We have PhD-level experts working with us and they will write assignments for you.

    ReplyDelete
  28. keep it up good info for everyone you can increase your page info 토토

    ReplyDelete
  29. 스포츠토토 Very informative and trustworthy blog that was really helpful. I will bookmark your site for future use.

    ReplyDelete
  30. 카지노사이트 This article will help the internet visitors for setting up new blog or even a weblog from start to end.

    ReplyDelete
  31. 카지노사이트 Its really a great and helpful piece of information. Please stay us up to date like this. Thanks for sharing.

    ReplyDelete
  32. Thanks for sharing this awesome content, it would be helpful
    Guys just sharing, I've found this interesting! 토토

    ReplyDelete
  33. No need to take tension for your biology homework just visit the "Best Assignment Experts" and try Biology Homework Help at an affordable price.

    ReplyDelete
  34. Amazing stuff thanks for the amazing information.Could you please cover an article about the best air purifier manufacturer

    I'll be very thankful for you.

    ReplyDelete
  35. Can I simply just say what a comfort to find an individual who truly understands what they’re talking about on the net. You definitely realize how to bring a problem to light and make it important. More and more people have to look at this and understand this side of your story. It’s surprising you’re not more popular given that you most certainly have the gift.
    국내경마

    magosucowep

    ReplyDelete
  36. Really This goes far beyond the commenting! It wrote his thoughts while reading the article amazingly :)

    야동

    ReplyDelete
  37. “I think commenting is the best part of my blogging – especially here at Pro Blogger. You see I’m not that profound or wise, but many of my readers are. Comments add value to my blog. They take my posts to the next level and often take my ideas in rewarding new directions.”

    오피

    ReplyDelete
  38. These are all really solid tips. I can’t tell you how often I see a comment on one of the blogs I write for that amounts to “nice post” and nothing more. I’ve even worked at a couple of sites that delete comments that don’t add to the discussion!

    마사지

    ReplyDelete
  39. You need to be a part of a contest for one of the best blogs on the net.

    건전마사지

    ReplyDelete

  40. Just want to say your article is as astounding. The clearness in your post
    is simply excellent and i can assume you’re an expert on this subject.
    Fine with your permission let me to grab your feed to keep up to date with forthcoming post. 오피월드


    ReplyDelete
  41. So good indeed! Glad to have found your page!! This is such great work!! Interesting to read for sure!! 텍사스홀덤

    ReplyDelete
  42. Fantastic work! This really can be the kind of data which needs to really be shared round the internet. Shame on Google for perhaps not placement this specific informative article much higher! 파칭코

    ReplyDelete
  43. Very nice post. I just stumbled upon your weblog and wanted to
    say that I’ve really loved browsing your blog posts. After all I’ll
    be subscribing to your rss feed and I am hoping you write once more very soon!
    일본경마

    magosucowep

    ReplyDelete
  44. Great web site. A lot of useful information here. I’m sending it to several friends and also sharing in delicious. And obviously, thanks in your effort!

    바카라사이트

    ReplyDelete
  45. It’s so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also.
    바카라사이트

    ReplyDelete
  46. I really enjoy your web’s topic. Very creative and friendly for users. Definitely bookmark this and follow it everyday.
    카지노사이트

    ReplyDelete
  47. I finally found great post here. Thanks for the information. Please keep sharing more articles.
    스포츠토토

    ReplyDelete
  48. This is really helpful post and very informative there is no doubt about it.
    온라인카지노

    ReplyDelete

  49. Awesome issues here. I am very satisfied to look your article.
    Thanks a lot and I’m taking a look forward to contact you. 오피월드



    ReplyDelete
  50. Hello! This post could not be written any better! 파워볼

    ReplyDelete
  51. Good day! I could have sworn I’ve been to your blog before but after going through many of the articles I realized it’s new to me. 온라인경마

    ReplyDelete
  52. This website and I conceive this internet site is really informative ! Keep on putting up! 파친코사이트

    ReplyDelete
  53. Great information, thanks for sharing it with us
    스포츠토토

    ReplyDelete
  54. Thank you for sharing this useful article , and this design blog simple and user friendly regards. 포커게임

    ReplyDelete
  55. Great Post for Beginner to understand. I finally found great post here. Thanks for information. Keep sharing more articles. 슬롯머신

    ReplyDelete
  56. Hi there, You have done an excellent job. I will certainly digg it and personally suggest to my friends.
    I am confident they will be benefited from this web site. 카지노사이트

    ReplyDelete
  57. Great goods from you, man. I have understand your stuff previous to and you’re just too fantastic. I really like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it enjoyable and you still care for to keep it sensible. 카지노사이트탑

    ReplyDelete
  58. Hi there, the whole thing is going well here and ofcourse every one is sharing information, that’s really fine, keep up writing. 카지노사이트

    ReplyDelete
  59. I really enjoy your web’s topic. Very creative and friendly for users. Definitely bookmark this and follow it everyday.

    스포츠토토링크

    ReplyDelete
  60. You absolutely come with really good articles and reviews. Regards for sharing with us your blog. 바카라사이트

    ReplyDelete
  61. I really appreciate this wonderful post that you have provided for us. I feel strongly that love and read more on this topic 카지노사이트
    <

    ReplyDelete
  62. Full Circle training studio is an EMS Studio in Dubai that provides the most efficient workout for your entire body including weight loss. To know about Full Circle health and fitness services, you can look for EMS training and other modern tools for improving health.

    ReplyDelete
  63. I surprised with the research you made to create this actual post incredible. Fantastic job! 토토사이트

    ReplyDelete
  64. Awesome. its really surprising to see this on a top ten stringing machines for tennis rackets platforms it's really appreciated.

    ReplyDelete
  65. Intimately, the article is in reality the best on this precious topic. I agree with your conclusions and also can thirstily look forward to your coming updates. Feel free to visit my website; 먹튀검증가이드

    ReplyDelete
  66. Thank you so much, I was searching for the information the whole day. Now I've got the answers to the questions I have. Feel free to visit my website; 카지노사이트링크

    ReplyDelete
  67. You are so cool! I do not suppose I have read a single thing like this before. So good to find somebody with some original thoughts on this topic. Seriously.. many thanks for starting this up. Also, check out how to find airpod case. Feel free to visit my website; 온라인카지노사이트넷

    ReplyDelete
  68. Thank you for this fascinating post, I am happy I observed this website on Google. Not just content, in fact, the whole site is fantastic. Feel free to visit my website; 배트맨토토프로

    ReplyDelete
  69. Thanks for posting an informative blog. A good blog with creative content. I would like to share some thoughts regarding college essay help, As I am working as an academic expert, those who are searching for assignment assistance. Get in touch with us.

    ReplyDelete
  70. The Hindu calendar is used by Hindus all over India. It consists of 12 months with 30 days each. The Hindu year starts on the first day of Chaitra (March) in the month of Puratashi, which is also called Chaitra masa Suklapaksha paksha Prathamai.hindu calendar

    ReplyDelete
  71. I like this a lot. Thank you for sharing. I’m always looking for upcycles like this. In the end, you don’t know it was a shipping pallet to begin with!


    https://www.totosafeguide.com

    ReplyDelete
  72. One other issue is when you are in a predicament where you would not have a co-signer then you may genuinely wish to try to exhaust all of your financing options. You can get many grants or loans and other grants that will give you finances to assist with school expenses. Thank you for the post.
    안전토토사이트

    ReplyDelete
  73. Especially if you’re unfamiliar with the different types jackets and coats than we are here only to provide you our valentines day sale form men at your doorstep worldwide.

    ReplyDelete
  74. Hey, this day is too much good for me, since this time I am reading this enormous informative article here at my home. Thanks a lot for massive hard work. 카지노사이트

    ReplyDelete
  75. I was reading some of your articles on this website and I conceive this web site is very instructive! Retain putting up.

    토토사이트

    ReplyDelete
  76. It's always a pleasure to read your magnificent articles on this site. You are among the top writers of this generation, and there's nothing you can do that will change my opinion on that. 카지노사이트

    ReplyDelete
  77. Youre so right. Im there with you. Your weblog is definitely worth a read if anyone comes throughout it. Im lucky I did because now Ive received a whole new view of this 토토사이트

    ReplyDelete
  78. I like this web blog its a master peace ! Glad I found this on google . You are amazing! Thank you! 토토사이트

    ReplyDelete
  79. Usually I do not read article on blogs, but I wish to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Thanks, quite nice post. 카지노사이트

    ReplyDelete
  80. Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon. 파워볼사이트

    ReplyDelete
  81. I do like the way you have framed this particular matter and it really does supply me personally some fodder for thought. Still, thank you for this excellent piece and whilst I do not go along with this in totality, I regard the perspective. 바카라사이트

    ReplyDelete
  82. Terima kasih sudah berbagi info. Aku sangat menghargai usahamu.
    dan aku akan menunggu tulisan berikutnya terima kasih sekali lagi.


    https://www.safecasinosite.net

    ReplyDelete
  83. When I read your article on this topic, the first thought seems profound and difficult. There is also a bulletin board for discussion of articles and photos similar to this topic on my site, but I would like to visit once when I have time to discuss this topic. sòng bạc


    ReplyDelete
  84. C'est incroyable de visiter rapidement ce site Web et de lire le point de vue de tous les collègues.
    J'ai également hâte de me familiariser avec ce texte.


    https://www.safecasinosite.net

    ReplyDelete
  85. Appreciate the effort and information you have given in writing this article . 바카라사이트

    ReplyDelete
  86. I wonder why the other experts of this sector don’t notice this. You must continue your writing. I’m sure, you’ve a huge readers’ base already! want to learn more? click the link here 카지노사이트

    ReplyDelete
  87. I would appreciate you that you pick up an important topic to write a thoroughly informative post on. I hope that you never stop and keep posting such valuable content 토토

    ReplyDelete
  88. Daebak! that’s what I was looking for, what a information! present here at this website 바카라사이트

    ReplyDelete