Cannot enter text in input field in IE6? - internet-explorer-6

Please let me know how do I enable to enter text in input field in IE6 ?

Remove the readonly and/or disabled attributes.
document.getElementById('yourInputId').readonly = '';
document.getElementById('yourInputId').disabled = '';
or:
document.getElementById('yourInputId').removeAttribute('readonly');

with jquery
$('#id').attr("disabled", false);
$('#id').removeAttr("readonly");
if it is what you mean ?

Related

How to enable a checkbox using AUI script

This is the code to get the value of a checkbox
var email = A.one("#<portlet:namespace/>email").attr('checked');
What is the code to set/enable the checkbox with a tick ?
A.one("#<portlet:namespace/>email").prop('checked', email); //this does not work
A.one("#<portlet:namespace/>email").set('value', email);//this also does not work
Many thanks
You can use Node#set:
A.one("#<portlet:namespace/>email").set('checked', true);
Or you can use Node#setAttribute:
A.one("#<portlet:namespace/>email").setAttribute('checked', true);

Calling "param.get" Client side?

Thanks to the great help on this forum, I was able to get this working:
Displaying Extension Library Dialog box when page loads?
Now what I need to do is not display the dialog box if a parameter is not in the URL. I can do this server side with param.get. How can I get the parameter client side? or is there some work araound?
<xp:scriptBlock rendered="#{not(empty(param.showDialog))}">...
...or, if you want to check for a specific value:
<xp:scriptBlock rendered="#{param.showDialog eq '1'}">...
If rendered evaluates to false, the client script is never sent, so the dialog will not be automatically opened.
Thanks Tim. I could not get your sample to work. I am sure it was something I did wrong. I went with the below. More complicated but it works for me and need to move on:
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
if (getParameterByName('msg') != "")
XSP.openDialog('#{id:dlgMessage}')

Kentico 7 hide editable text if it's empty

I have an editable text web part on a page template. It has a custom HTML envelope before and after the text. How can I hide the whole thing, envelope included, if the editable text is empty?
I need to hide it because the envelope adds stylized markup that shouldn't be visible when there is no text.
Can it be done with a K# snippet on the Visible property? I'm unclear how interrogating a document's property works.
Thanks!
Try this as the "Visible" property:
{% (ViewMode != "LiveSite") || (CMSContext.CurrentDocument.editabletext != "") #%}
Change "editabletext" to whatever you have for your web part control ID.
I'm not familiar with Kentico but these solutions might help. They may not address your problem specifically but might aid in a solution.
CMSEditableImage Extension Method
I came up with a way to check this, I added an extension method for
the CMSEditableImage class that takes the CurrentPage PageInfo object
to check the value of the editable region, don't know if this is the
best way or not, but here's the code.
public static bool IsPopulated(this CMSEditableImage editableImage, PageInfo currentPage)
{
bool isPopulated = false;
string value = currentPage.EditableItems.EditableRegions[editableImage.ID.ToLower()].ToString();
if (!string.IsNullOrEmpty(value))
{
value = value.ToUpper();
isPopulated = (value == "<IMAGE><PROPERTY NAME=\"IMAGEPATH\"></PROPERTY></IMAGE>") ? false : true;
}
return isPopulated;
}
via http://devnet.kentico.com/Forums/f19/fp5/t4454/Empty-CMSEditableImage.aspx
JavaScript Method
The webcontainer needs an id, example:
<h2 id="webpart-header">Headline</h2>
Then I have a small javascript function that is attached in an
external js file:
/* Hide Webcontainer via javascript if empty*/
function hideLayer(element) {
elem = document.getElementById( element );
elem.style.display = "none";
}
Now in the wep part configuration, at no data behaviour, you uncheck the checkbox and call the js function by entering following
script in the no record found text: hideLayer("webpart-header");
Whereby webpart-header the id name of your container is. You could
also have a more complex <div> structure here.
via http://devnet.kentico.com/Forums/f22/fp3/t4180/Webcontainer-and-hide-if-no-data.aspx

Validation for entered string in Edit Box in MFC

I have created a user login Dialog Box in MFC, which have two edit fields, for username & password respectively. I need to restrict/disable user from typing "space" & a few "special characters" in Login/Password Edit Box fields. Please help me with this. Thank you.
EDIT: I'm validating the Username & Password with my SQLite database. Everything is working fine. Additional requirement is to restrict user from typing spaces in the edit field.
Please explain with some simple example. Thank you.
You need to subclass(Inherit) the CEdit control of MFC and override PreTranslateMessage and handle WM_CHAR message and filter the characters there
BOOL CMyEditBox::PreTranslateMessage(MSG* pMsg)
{
int nTextLength = this->GetWindowTextLength();
if(pMsg->message==WM_CHAR)
{
// Ignoring 0 to 9
if( ( pMsg->wParam >= '0' && pMsg->wParam <= '9' ) )
{
return true;
}
}
return CEdit::PreTranslateMessage(pMsg);
}
Handle the edit-control change in EN_CHANGE notification message.
Check http://www.flounder.com/validating_edit_control.htm.
It has an explanation plus sample code
EDIT
By the way, I'm not sure that "live validation" for a password field is a good idea. I think "lazy validation" is a better solution here.
As per above answer, this works fine but you can also override CEdit with ASCII values,(in this case we used HEX values followed by '\x')
BOOL TestDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_CHAR)
{
if( ( pMsg->wParam >= '\x20' && pMsg->wParam <= '\x2D'))
{
return true;
}
}
return CEdit::PreTranslateMessage(pMsg);
}

How do I get the select box values in YUI 3?

In YUI 3 I have a node that is my select box:
Y.get('#regionSelect');
How do I get the <option> values that are currently selected (even if there are more than one?) Also, is there a tutorial out there that tells me explicitly how to do this (I don't want to serialize a whole form)?
Once you have the selector, you can chain get and each
Y.get("#regionSelect").get("options").each( function() {
// this = option from the select
var selected = this.get('selected');
var value = this.get('value');
var text = this.get('text');
// apply secret sauce here
});
I've just been using the demos/examples on http://developer.yahoo.com/yui/3/ to figure things out.
// Selected Value
Y.one('#regionSelect')._node.value;
Y.one('#regionSelect').get('value');
// Selected Index
Y.one('#regionSelect')._node.selectedIndex;
Y.one('#regionSelect').get('selectedIndex');
You might not need to iterate through all options if you need just a selected one:
var index = Y.get("#regionSelect").get('selectedIndex');
var value = Y.get("#regionSelect").get("options").item(index).getAttribute('value');
You can directly use this. Require selector-css3 module to support IE.
YUI().use("selector-css3", "node", function (Y) {
var text = Y.one("#ownerSelector option:checked").get("text");
});
http://jsfiddle.net/neosoyn/r8crW/

Resources