Jump to content

auto clear default text onfocus and reput the text onblur


Recommended Posts

Hi,

Caspio provides the js to auto clear on focus but don't go further to recall the text onblur ...

i have a js but can't adapt it to caspio .. any help would be much appreciated.

function remName(a, B){

if(a.value==B){

a.value='';

}else if(a.value==''){

a.value=b;

}else{

a.value=a.value;

}

}

function chkName(a, B){

if(a.value==''){

a.value=b;

}else{

a.value=a.value;

}

}

var valeur = document.getElementById("InsertRecordEMAIL").value;

document.getElementById('InsertRecordEMAIL').onfocus = remName(this, 'valeur');

document.getElementById('InsertRecordEMAIL').onblur = chkName(this, 'valeur');

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi,

Try this

document.getElementById('InsertRecordEMAIL').onfocus = function( e ) { remName(e, valeur); }
document.getElementById('InsertRecordEMAIL').onblur = function( e ) { chkName(e, valeur); }
instead of

document.getElementById('InsertRecordEMAIL').onfocus = remName(this, 'valeur');
document.getElementById('InsertRecordEMAIL').onblur = chkName(this, 'valeur');

Let me know if this helps.

Link to comment
Share on other sites

  • 2 weeks later...

i tried this and it's not working, am i missing something ? where do you get the function (e) ?

function remName(a, B){

if(a.value==B){

a.value='';

}else if(a.value==''){

a.value=b;

}else{

a.value=a.value;

}

}

function chkName(a, B){

if(a.value==''){

a.value=b;

}else{

a.value=a.value;

}

}

var valeur = document.getElementById("InsertRecordEMAIL").value;

document.getElementById('InsertRecordEMAIL').onfocus = function( e ) { remName(e, valeur); }

document.getElementById('InsertRecordEMAIL').onblur = function( e ) { chkName(e, valeur); }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...