Client side Javascript assigning the default Static values to UserName and Email
Hi I worte a js client side and rendered that server side aswell when i user filling the form the Username field need to be simultaneously filled based on Email input before submiting the form.
My query is in the Email field and Username field the values "UserName"
and "Email" are appearing by Default and also i cant edit the email field the forms is able to submit with valuse UserName and Email which is not i am looking.
the below code is my client side JS
<asp:TextBox ID="Email" runat="server" onkeyup="change();"></asp:TextBox>
function change()
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName').value = 'UserName';
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email').value = 'Email';
UserName.value=Email.value;
The below is my C# which i used stringbuilder
protected override void RenderContents(HtmlTextWriter writer)
{
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.Append(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
The reason i added my code into C# stringbuilder is i am unable to get the java code on clientside when checked using f12 i am not able to see any of the java code which i wrote on aspx page so i used string builder to get that code.
Thanks
javascript
add a comment |
Hi I worte a js client side and rendered that server side aswell when i user filling the form the Username field need to be simultaneously filled based on Email input before submiting the form.
My query is in the Email field and Username field the values "UserName"
and "Email" are appearing by Default and also i cant edit the email field the forms is able to submit with valuse UserName and Email which is not i am looking.
the below code is my client side JS
<asp:TextBox ID="Email" runat="server" onkeyup="change();"></asp:TextBox>
function change()
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName').value = 'UserName';
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email').value = 'Email';
UserName.value=Email.value;
The below is my C# which i used stringbuilder
protected override void RenderContents(HtmlTextWriter writer)
{
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.Append(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
The reason i added my code into C# stringbuilder is i am unable to get the java code on clientside when checked using f12 i am not able to see any of the java code which i wrote on aspx page so i used string builder to get that code.
Thanks
javascript
add a comment |
Hi I worte a js client side and rendered that server side aswell when i user filling the form the Username field need to be simultaneously filled based on Email input before submiting the form.
My query is in the Email field and Username field the values "UserName"
and "Email" are appearing by Default and also i cant edit the email field the forms is able to submit with valuse UserName and Email which is not i am looking.
the below code is my client side JS
<asp:TextBox ID="Email" runat="server" onkeyup="change();"></asp:TextBox>
function change()
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName').value = 'UserName';
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email').value = 'Email';
UserName.value=Email.value;
The below is my C# which i used stringbuilder
protected override void RenderContents(HtmlTextWriter writer)
{
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.Append(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
The reason i added my code into C# stringbuilder is i am unable to get the java code on clientside when checked using f12 i am not able to see any of the java code which i wrote on aspx page so i used string builder to get that code.
Thanks
javascript
Hi I worte a js client side and rendered that server side aswell when i user filling the form the Username field need to be simultaneously filled based on Email input before submiting the form.
My query is in the Email field and Username field the values "UserName"
and "Email" are appearing by Default and also i cant edit the email field the forms is able to submit with valuse UserName and Email which is not i am looking.
the below code is my client side JS
<asp:TextBox ID="Email" runat="server" onkeyup="change();"></asp:TextBox>
function change()
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName').value = 'UserName';
document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email').value = 'Email';
UserName.value=Email.value;
The below is my C# which i used stringbuilder
protected override void RenderContents(HtmlTextWriter writer)
{
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName= document.getElementById('#ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.Append(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
The reason i added my code into C# stringbuilder is i am unable to get the java code on clientside when checked using f12 i am not able to see any of the java code which i wrote on aspx page so i used string builder to get that code.
Thanks
javascript
javascript
asked Nov 13 '18 at 17:15
RamSPRamSP
12
12
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I managed to fix the issue.
I have used the below code
function change()
var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');
var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');
UserName.value = Email.value;
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.AppendLine(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
Thanks
add a comment |
Your Answer
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%2f53286337%2fclient-side-javascript-assigning-the-default-static-values-to-username-and-email%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
I managed to fix the issue.
I have used the below code
function change()
var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');
var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');
UserName.value = Email.value;
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.AppendLine(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
Thanks
add a comment |
I managed to fix the issue.
I have used the below code
function change()
var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');
var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');
UserName.value = Email.value;
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.AppendLine(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
Thanks
add a comment |
I managed to fix the issue.
I have used the below code
function change()
var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');
var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');
UserName.value = Email.value;
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.AppendLine(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
Thanks
I managed to fix the issue.
I have used the below code
function change()
var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');
var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');
UserName.value = Email.value;
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
sb2.AppendLine(@"<script language='javascript'>");
sb2.AppendLine(@"function change()");
sb2.AppendLine(@"var Email = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_Email');");
sb2.AppendLine(@"var UserName = document.getElementById('ctl00_ctl40_g_e7fed4bf_b25a_4a8a_943d_e31932556a9e_FBACreateUserWizard_CreateUserStepContainer_UserName');");
sb2.AppendLine(@"UserName.value=Email.value;");
sb2.AppendLine(@" ");
sb2.AppendLine(@"</script>");
if (!Page.ClientScript.IsStartupScriptRegistered("JSScript"))
Page.ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb2.ToString());
Thanks
answered Nov 14 '18 at 15:57
MarSPMarSP
14
14
add a comment |
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%2f53286337%2fclient-side-javascript-assigning-the-default-static-values-to-username-and-email%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