0

When I want to see TT.MM.JJJJ as a default but because ampscript is used it shows dd/mm/yyyy

I have added placeholder and timezone as well but it is not working. Could you please advise on that?

 set @datum = RequestParameter("datum")
 ]%%
          <form id="form" class="mainForm" method="post" style="max-width: 640px; margin: 0 auto; padding: 20px 20px 0; font-size: 13px;" action="%%=RequestParameter('PAGEURL')=%%">
            <div style="line-height: 15px;">
                <h2 style="font-weight: 15; line-height: 28px; font-size: 35px; text-align: center;">Mein Geburtsdatum
                  </h2>
                 <div style="border: none; font-weight: 18; line-height: 10px;">
                <label>Datum</label>
              </div>
              <div>
                <input class="slds-input" type="date" style="margin: 10px auto; width: 100%; font-weight: 16;" id="datum" name="datum" required="" value="%%=v(@datum)=%%">    
              </div>
            </div>
            <div class="buttons_block" style="width: 100%; margin: 10px; auto">
            <div class="second_button">
              <input name="SubscriberKey" type="hidden" value="%%=v(@SubscriberKey)=%%">
              <input name="submitted1" type="hidden" value="true">
            <button type="submit" style="background: #FFA500; border-radius:5px; border:1px solid #FFA500; color:#ffffff; padding:15px 40px; font-size: 15px;">Weiter
              </button></div>```

1 Answer 1

0
<input class="slds-input" 
type="date" 
style="margin: 10px auto; width: 100%; font-weight: 16;" 
id="datum" name="datum" required="" 
value="%%=FormatDate(@datum,"s",,"de-DE")=%%">

should return format: 24.12.2024

2
  • ^This, and I also recommend adding the placeholder if you want to make the value visible, and add the disabled attribute if you want to prevent people from editing it. Keep in mind, with the way your code is set up - no matter what a visitor enters, it'll pass the value at var-datum. If that's the desired outcome - you should use the disabled attribute in your input. If not, only have var-datum in the placeholder attribute. Commented Mar 21 at 12:04
  • Unfortunately like placeholder is not visible like I described before and when I change the code to above code I get error due to try catch condition on ssjs so it does not allows Commented Mar 25 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .