How to pass the original value and not the replace number ( * ) The Next CEO of Stack OverflowWhat are valid values for the id attribute in HTML?How do I enumerate an enum in C#?How to horizontally center a <div>?Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?How do I check if an element is hidden in jQuery?What are the correct version numbers for C#?How do I redirect to another webpage?How can I know which radio button is selected via jQuery?How to check whether a checkbox is checked in jQuery?How do I generate a random int number?
Horror film about a man brought out of cryogenic suspension without a soul, around 1990
Why can't we say "I have been having a dog"?
What did the word "leisure" mean in late 18th Century usage?
Upgrading From a 9 Speed Sora Derailleur?
Is it a bad idea to plug the other end of ESD strap to wall ground?
MT "will strike" & LXX "will watch carefully" (Gen 3:15)?
What happens if you break a law in another country outside of that country?
Man transported from Alternate World into ours by a Neutrino Detector
Strange use of "whether ... than ..." in official text
Another proof that dividing by 0 does not exist -- is it right?
Car headlights in a world without electricity
Calculate the Mean mean of two numbers
Masking layers by a vector polygon layer in QGIS
Salesforce opportunity stages
How to show a landlord what we have in savings?
Simplify trigonometric expression using trigonometric identities
Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact
Is it okay to majorly distort historical facts while writing a fiction story?
Calculating discount not working
How do I keep Mac Emacs from trapping M-`?
Can this transistor (2n2222) take 6V on emitter-base? Am I reading datasheet incorrectly?
Direct Implications Between USA and UK in Event of No-Deal Brexit
How do I secure a TV wall mount?
pgfplots: How to draw a tangent graph below two others?
How to pass the original value and not the replace number ( * )
The Next CEO of Stack OverflowWhat are valid values for the id attribute in HTML?How do I enumerate an enum in C#?How to horizontally center a <div>?Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?How do I check if an element is hidden in jQuery?What are the correct version numbers for C#?How do I redirect to another webpage?How can I know which radio button is selected via jQuery?How to check whether a checkbox is checked in jQuery?How do I generate a random int number?
I mask the numbers of SSN obviously for security... but when I submit, the variable fill with "*--****" and is suppose to grab the original input ex. 123-45-6789. I just want to mask that input.
JQuery:
$(function ()
$('#ssn').keyup(function ()
var val = this.value.replace(/[^d*]/g, '').replace(/d/g, '*');
var newVal = '';
var sizes = [3, 2, 4];
var maxSize = 10;
for (var i in sizes)
if (val.length > sizes[i])
newVal += val.substr(0, sizes[i]) + '-';
val = val.substr(sizes[i]);
else
break;
newVal += val;
this.value = newVal;
);
);
HTML:
<div class="col-lg-3 col-md-4">
@Html.LabelFor(model => model.SolicitantDataView.SSN, htmlAttributes: new @class = "control-label col-lg-12 col-md-3 required" )
@Html.EditorFor(model => model.SolicitantDataView.SSN, new htmlAttributes = new @class = "form-control ssn ssnControl", @id = "ssn", @maxlength = "11" )
@Html.ValidationMessageFor(model => model.SolicitantDataView.SSN, "", new @class = "text-danger" )
</div>
I try this way but the require method not work anymore...
$(document).ready(function()
$('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 );
);
c# jquery html asp.net-mvc
add a comment |
I mask the numbers of SSN obviously for security... but when I submit, the variable fill with "*--****" and is suppose to grab the original input ex. 123-45-6789. I just want to mask that input.
JQuery:
$(function ()
$('#ssn').keyup(function ()
var val = this.value.replace(/[^d*]/g, '').replace(/d/g, '*');
var newVal = '';
var sizes = [3, 2, 4];
var maxSize = 10;
for (var i in sizes)
if (val.length > sizes[i])
newVal += val.substr(0, sizes[i]) + '-';
val = val.substr(sizes[i]);
else
break;
newVal += val;
this.value = newVal;
);
);
HTML:
<div class="col-lg-3 col-md-4">
@Html.LabelFor(model => model.SolicitantDataView.SSN, htmlAttributes: new @class = "control-label col-lg-12 col-md-3 required" )
@Html.EditorFor(model => model.SolicitantDataView.SSN, new htmlAttributes = new @class = "form-control ssn ssnControl", @id = "ssn", @maxlength = "11" )
@Html.ValidationMessageFor(model => model.SolicitantDataView.SSN, "", new @class = "text-danger" )
</div>
I try this way but the require method not work anymore...
$(document).ready(function()
$('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 );
);
c# jquery html asp.net-mvc
add a comment |
I mask the numbers of SSN obviously for security... but when I submit, the variable fill with "*--****" and is suppose to grab the original input ex. 123-45-6789. I just want to mask that input.
JQuery:
$(function ()
$('#ssn').keyup(function ()
var val = this.value.replace(/[^d*]/g, '').replace(/d/g, '*');
var newVal = '';
var sizes = [3, 2, 4];
var maxSize = 10;
for (var i in sizes)
if (val.length > sizes[i])
newVal += val.substr(0, sizes[i]) + '-';
val = val.substr(sizes[i]);
else
break;
newVal += val;
this.value = newVal;
);
);
HTML:
<div class="col-lg-3 col-md-4">
@Html.LabelFor(model => model.SolicitantDataView.SSN, htmlAttributes: new @class = "control-label col-lg-12 col-md-3 required" )
@Html.EditorFor(model => model.SolicitantDataView.SSN, new htmlAttributes = new @class = "form-control ssn ssnControl", @id = "ssn", @maxlength = "11" )
@Html.ValidationMessageFor(model => model.SolicitantDataView.SSN, "", new @class = "text-danger" )
</div>
I try this way but the require method not work anymore...
$(document).ready(function()
$('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 );
);
c# jquery html asp.net-mvc
I mask the numbers of SSN obviously for security... but when I submit, the variable fill with "*--****" and is suppose to grab the original input ex. 123-45-6789. I just want to mask that input.
JQuery:
$(function ()
$('#ssn').keyup(function ()
var val = this.value.replace(/[^d*]/g, '').replace(/d/g, '*');
var newVal = '';
var sizes = [3, 2, 4];
var maxSize = 10;
for (var i in sizes)
if (val.length > sizes[i])
newVal += val.substr(0, sizes[i]) + '-';
val = val.substr(sizes[i]);
else
break;
newVal += val;
this.value = newVal;
);
);
HTML:
<div class="col-lg-3 col-md-4">
@Html.LabelFor(model => model.SolicitantDataView.SSN, htmlAttributes: new @class = "control-label col-lg-12 col-md-3 required" )
@Html.EditorFor(model => model.SolicitantDataView.SSN, new htmlAttributes = new @class = "form-control ssn ssnControl", @id = "ssn", @maxlength = "11" )
@Html.ValidationMessageFor(model => model.SolicitantDataView.SSN, "", new @class = "text-danger" )
</div>
I try this way but the require method not work anymore...
$(document).ready(function()
$('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 );
);
c# jquery html asp.net-mvc
c# jquery html asp.net-mvc
edited Mar 8 at 20:43
Jonathan Padilla
asked Mar 8 at 19:13
Jonathan PadillaJonathan Padilla
337
337
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
By replace() ing the val, you override the original typed data. That's why you get only asterisks. A simple aproach would be using a hidden control input, in which you store the typed value before masking. But the right thing to do is to use a js mask extension which supports SSN (or, even better, a custom mask).
can you explain with a example, I'm new at js =/
– Jonathan Padilla
Mar 8 at 20:03
I do it like this way $(document).ready(function() $('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 ); ); but the require gone... why?
– Jonathan Padilla
Mar 8 at 20:42
add a comment |
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069568%2fhow-to-pass-the-original-value-and-not-the-replace-number%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
By replace() ing the val, you override the original typed data. That's why you get only asterisks. A simple aproach would be using a hidden control input, in which you store the typed value before masking. But the right thing to do is to use a js mask extension which supports SSN (or, even better, a custom mask).
can you explain with a example, I'm new at js =/
– Jonathan Padilla
Mar 8 at 20:03
I do it like this way $(document).ready(function() $('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 ); ); but the require gone... why?
– Jonathan Padilla
Mar 8 at 20:42
add a comment |
By replace() ing the val, you override the original typed data. That's why you get only asterisks. A simple aproach would be using a hidden control input, in which you store the typed value before masking. But the right thing to do is to use a js mask extension which supports SSN (or, even better, a custom mask).
can you explain with a example, I'm new at js =/
– Jonathan Padilla
Mar 8 at 20:03
I do it like this way $(document).ready(function() $('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 ); ); but the require gone... why?
– Jonathan Padilla
Mar 8 at 20:42
add a comment |
By replace() ing the val, you override the original typed data. That's why you get only asterisks. A simple aproach would be using a hidden control input, in which you store the typed value before masking. But the right thing to do is to use a js mask extension which supports SSN (or, even better, a custom mask).
By replace() ing the val, you override the original typed data. That's why you get only asterisks. A simple aproach would be using a hidden control input, in which you store the typed value before masking. But the right thing to do is to use a js mask extension which supports SSN (or, even better, a custom mask).
answered Mar 8 at 19:39
Igor AraújoIgor Araújo
1
1
can you explain with a example, I'm new at js =/
– Jonathan Padilla
Mar 8 at 20:03
I do it like this way $(document).ready(function() $('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 ); ); but the require gone... why?
– Jonathan Padilla
Mar 8 at 20:42
add a comment |
can you explain with a example, I'm new at js =/
– Jonathan Padilla
Mar 8 at 20:03
I do it like this way $(document).ready(function() $('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 ); ); but the require gone... why?
– Jonathan Padilla
Mar 8 at 20:42
can you explain with a example, I'm new at js =/
– Jonathan Padilla
Mar 8 at 20:03
can you explain with a example, I'm new at js =/
– Jonathan Padilla
Mar 8 at 20:03
I do it like this way $(document).ready(function() $('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 ); ); but the require gone... why?
– Jonathan Padilla
Mar 8 at 20:42
I do it like this way $(document).ready(function() $('.ssn').unmask().maskSSN('999-99-9999', maskedChar: 'X', maskedCharsLength: 5 ); ); but the require gone... why?
– Jonathan Padilla
Mar 8 at 20:42
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069568%2fhow-to-pass-the-original-value-and-not-the-replace-number%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
