Developer forum

Forum » Templates » Email Textbox value problem

Email Textbox value problem

Dmitrij Jazel
Reply
Hej DW guys,

I have a situation here, hope there is easy workaround...
I want to make this newsletter box, with one email field. (see attachment)
Onfocus I want it to become blank.
The problem is I can't get this textbox get initial value to be "Din email" instead, it writes whole  DWtag because that is what I am putting in value.
                        <input name="AccessUserEmail" type="text" id="AccessUserEmail_425"  onfocus="this.value=''" maxlength="50" class="FrontendStd" value="<!--@AccessUserEmail-->" />
I tryed JS also to change initial value but anytime I touched value, it does not do what I need.
Any suggestion here?

Regards,
Dmitrij

OrderNewsletter.png

Replies

 
Daniel Williams
Reply
This post has been marked as an answer
 The easiest way around it, is to make a div as a parent, and then catch the input field on that. $("div#emailNewsletter input[type="text"]").whatever();
Votes for this answer: 0
 
Dmitrij Jazel
Reply
 Hej Daniel,

Yea, looks like it is the option, I made some javascript that gets the textbox by id and than I do whatever with it. The most important thing was to use  instead of workaround I wanted to try here...
Eventual result... 
<script>
    $(document).ready(function () {
        document.getElementById('AccessUserEmail_425').value = 'Din email';
    });

</script>

<form method="post" ENCTYPE="multipart/form-data" action="<!--@EditRecipientUrl-->" onsubmit="return ValidateForm();">

    <div class="newsLetterEmailBoxHolder"><!--@AccessUserEmail_ctrl--></div><!--/newsLetterEmailBoxHolder-->

                                    <!--@AccessUserEmail_validator-->
    <input type="hidden" name="IsPostBack" value="<!--@IsPostBack-->" />
    <!--@LoopStart(CategoryLoop)-->  
    <!--@DwTemplateTags-->
      <input id="Category_<!--@CategoryID-->" style="visibility: hidden;" checked="checked" name="Category_<!--@CategoryID-->" type="checkbox" />
    <!--@LoopEnd(CategoryLoop)-->
     

    <input id="Submit" class="button tilmeldNyhedsbrev" name="Submit" type="submit" value="Tilmeld nyhedsbrev" />
    
</form>

<!--@LoopStart(Validation)-->
    <span id="<!--@Validation:Validator.ID-->" <!--@Validation:Validator.Display-->><!--@Validation:Validator.Message--></span>
<!--@LoopEnd(Validation)-->

<script type="text/javascript">
    document.getElementById("AccessUserEmail_425").onclick = function () {
        this.value = "";
    }
</script>

 

You must be logged in to post in the forum