show and hide Span/Label text in textbox - text

I am trying to implement a simple trick which would hide span/label inside textbox when user starts entering text in respective textbox, and show it, on blur if textbox is empty.
(It is implemented on user sign in form)
This thing is working okay so far and here is the demo
But it fails in following scenario:
1) If user enters username, previously entered username list (the form data stored by browser when auto-complete is turned off) appears. And if user selects username with mouse-click from the list, password field gets auto-populated. Now though password field has value in it, it won't hide the span.
(keydown/focus/click/change event over textbox not helping in this case)
2) When the username/password is wrong, page reloads, username textbox has last entered value. But still the span over it is being displayed.
(I tried to check if username textbox is empty on pageload. It didn't work)
Can anyone help me fix these things?
Thanks in advance... :)

What you need i s a placholder. Placeholder have been standardized by html5
and can be easily implemented via various jquery plugin (here is one).
i suggest you use those solutions, as they are standards. the ideal solution is to use html5 and than fallback to javascript for older browsers.
Look ath this form where i implemented placholders: http://www.consiglio.regione.lombardia.it/web/crl/BancheDati/atti_si
When you insert a letter in an input field, the text disappears. It's done with the help of that plugin.

It seems that you are attempting to reinvent the wheel here. Check this already answered question on what appears to be the same subject:
how do I make an html text box show a hint when empty

Usability-wise, I don't think it would be terrible to hide the watermarks of both inputs regardless of which on was clicked/keydowned etc. Now this next option is controversial, so you have been warned...
<input name="first_name" type="text" autocomplete="off">
Just wanted to make sure you were aware of that - most often used to prevent credit card fields from autocompleting. Hope something in here this helps.

Related

Custom behaviour for selfAsserted content?

Following this disabled social account from logon sample. Here's what I see when the Local Account user exists and is disabled:
NB - I've changed the ContentDefinition so that it's using 2.1.7 instead of 1.1.0.
I'm assuming the "hide me" text box is to be hidden using css? Which would mean that I would have to implement my own Template?
Also, there's a Cancel and a Continue button. Because the dummy textbox doesn't actually do anything, clicking the Continue button does not work. So I assume I want to hide the Continue button, but only when the dummy text box is present? Does that mean I should be looking at Javascript?
Finally, the UserMessageIfClaimsTransformationBooleanValueIsNotEqual error message (defined in the AAD-DisabledUserPage Technical Profile) does not appear anywhere in the source of the page. It seems integral to the strategy in the sample. Am I missing something?
I've looked at Customise the UI, Customise the UI with HTML template and Enable JavaScript and page layouts. There doesn't seem to be anything on customising the generated content. Have I missed something in the documentation?
Very strange so I had a look at the sample.
This is an old sample. It still uses "socialIdpUserId".
<! - The claim socialIdpUserId has been renamed to issuerUserId →
I renamed this in the base file to "issuerUserId".
Essentially, they needed a "dead-end" page.
But the dead-end page needs an output claim so they made a dummy one but wanted in removed!
I would have used a paragraph element. Maybe it wasn't available then?
I wrote that up a while back.
My version is in this gist.
If disabled, the user sees:
You can hide Cancel and Continue by modifying the technical profile. See the Metadata section here.

Click <span>? element or button without name or get submit to work

I've been poking around the internet at large cobbling together some VBA code to try to interact with some web pages (and eventually scrape).
I have some decent knowledge of VB and programming, but the internet end of things is pretty new to me, especially the syntax of commands, so I'm leveraging things from the internet.
I have one that's working,
http://snowload.atcouncil.org/
This I can fill in and get to submit with a
doc.getelementsbyId("coordinate_address").value = range("City").value _
& ", " & range("State").value
doc.getelementsbyId("btn-submit").click
then wait it out until readystate =4 , etc.
The one I can't get to work is here.
http://windspeed.atcouncil.org/
This one seems to use a object that I can't figure out how to click. It doesn't seem to have a name, and Id, etc.
If I use conventional 'submit' on the windspeed page, (loosely using that term), the page loads, but it comes out blank. Like I'm not using the syntax correctly, or not passing a variable/searchform somehow.
ie.document.all.item("submit").click
This 'works' but it produces a blank page with the east coast of africa and no data.
In the immediate/console of the browser, after I click, say, the Hawaii button, it works with document.searchform.submit()
If I try that in code, it doesn't work. (The Immediate window in the VBA editor thows me a "expected: =" error,
The object I am trying to click is in the web site code.....
<span>
<input type="submit" value="Get Windspeed" onclick="valbutton(searchform); return false;">
<span>
I've tried a lot of techniques poached from the internet, but no success yet. (looping over elements using getelementsbyclassname "span", but it either doesn't find the one with value ="Get Windspeed", or it doesn't find it at all.
somehow triggering the valbutton (that's a subroutine/function on the page) seems like a workaround... but VBA seems to want different syntax than the console on the web page and it's doing the same kind of "expected: =" syntax error when I try that approach.
I suspect normal submit would work, but I'm somehow not passing the filled out page and am sending a blank to the submit/get?
I also notice that if you are on the page, type in an address, and hit enter, it runs that "find" button I can't figure out (same thing, no name or ID obvious, it's a button....), and if you hit enter after it reloads, then it somehow by default hits that 'get windspeed' button, which suggests to me they are both submit buttons in a way.
Thanks for reading, I appreciate any thoughts on the matter. I am trying to get this to get all the data input and get the results without adding anything beyond VBA (i.e. jscript or vbscript or other things,)
-Brian
You should be able to simply submit the form after setting the .Value of the inputs.
doc.getelementsbyId("searchform").submit
I was able to adapt this (despite the claim this doesn't work in IE11..., maybe I'm not using 11...Is eleven Miscrosoft Edge?)
https://www.mrexcel.com/forum/excel-questions/344297-need-visual-basic-applications-code-execute-javascript.html
IE.Document.parentWindow.execScript "CheckAndSubmit(document.frmViewMyAcct);"
that allowed me to mimic hitting the button or hitting submit and somehow got around the 'no information / resulting page is blank' issue. The onclick event has a javascript routine attached to it, so I just copied that syntax.
Thanks for the help, it got me started on the solution.
Regards,
Brian

Issue related to Kentico on-line form (bizform) validation

I have created a form using Kentico on-line form and applied the built-in "required" validation on it. Whenever a textbox is empty then a required validation is shown. Now, I have entered a value in the textbox and press tab from the keyboard but the required message does not disappear. I want to remove or hide the message from the form when the user enters a value in the text box before the submit button is clicked.
How to resolve this issue?
I don't recall this being something that Kentico handles out-of-the-box. You'll most likely need to add some custom client-side script for this. Typically - where I work, at Ridgeway - we use custom layouts for forms, as the standard layout is fairly table-rich.

How to disable the whole page?

I have a field where a customer number is required. When the user leaves the field in the onblur event I need to run some code, in this case check if the given number is already in use. The problem is the codes needs some time to complete. For this short period the user should not be able to make any input. Also I'd like to display a gif.
There is a genius snippet on XSnippets called "Standby Dialog" (https://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control)
If you implement this on your page (preferably as custom control) you will get an overlay everytime a partial refresh happens. If you init a partial refresh when the user blurs the field you will get what you want.

How to change Liferay Flag drop down values?

In liferay message board thread if we click on "Flag" then a window pop-up is coming with drop down values like "Violent & repulsive", "Spam" etc.
I want to change these text with my own words. I found code inside tomcat-6.0.18\webapps\ROOT\html\portlet\flags\edit_entry.jsp:
<option value="<%= reason %>"><liferay-ui:message key="<%= reason %>" /></option>
which is displaying the drop down but how can I edit the drop-down menu with my own words?
If anyone can suggest me how to proceed for here will be great help for me.
Thanks.
One way (easiest) is to override the following property in portal-ext.properties:
flags.reasons=sexual-content,violent-or-repulsive-content,My own flag,My content,Your violent acts
Hope this helps.
Extend this (to make it multilingual) by providing a new localization key instead of just a text. You can use a hook to introduce a new localization key into the portal, then just use the key here. If the key cannot be found (like in this sample e.g. "My own flag") it will be shown nontranslated.

Resources