0

I’m having troubles with submitting data from custom html form to the data extension.

The current setup is:

  • microsite with 2 pages
  • 2-field form on the first page (dropdown field, and text filed)
  • AMPscript on the second page

The first problem is that dropdown field value is never making it’s way to DE. Second text field is OK. But than the second problem arises in a couple of hours: the whole flow stops working, and I have this: “500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.”

Form on first page:

<form class="sms_form_1" method="post" action="https://cloud.marketing.subdomain/unsub-sms-2">
 <div class="row">
  <div class="column_1">
   <label class="description">Prefix</label>
   <select id="element_3" mame="prefix"> 
    <option value="" selected disabled hidden>Choose</option>
     <option value="43">+43</option>
     <option value="49">+49</option>
     <option value="385">+385</option>
   </select>
  </div>
  <div class="column_2">
   <label class="description">Phone</label>
   <input id="element_2" type="text" pattern="[0-9]{5,10}" placeholder="eg. 994023461" name="number">
  </div>
 </div>
 <div class="row">
  <div class="column_full">
   <input id="saveForm" class="button_text" type="submit" name="submit" value="Unsubscribe">
  </div>
 </div>
</form>

Processing page:

%%[   
    set @pref = RequestParameter("prefix")
    set @num = RequestParameter("number")

    set @result = InsertData("DE_name", "Prefix", @pref, "Phone", @num)
]%%

%%=v(@result)=%%
1

The first problem is, that you have a typo in your Prefix-select. Instead of mame you need to put name. Then the value should be passed correctly:

<select id="element_3" name="prefix"> 

If the process works at first submission, I guess the rest of the problem lies within the data extension, so my guess is that there is some kind of primary key violation, etc.
If you reviewed the data extension and cannot find an issue I suggest you add the data extension configuration to your question and try debugging your code with an SSJS try/catch-block and supplying the given (more detailed) error message:

<script runat="server">
    Platform.Load("core","1"); 
    try {
</script>

%%[   
    set @pref = RequestParameter("prefix")
    set @num = RequestParameter("number")

    set @result = InsertData("DE_name", "Prefix", @pref, "Phone", @num)
]%%

%%=v(@result)=%%

<script runat="server">
    } catch (e) {
        Write("e: " + Stringify(e));
    }
</script> 
  • Thank you, Markus! – Vitaly Belyakov Aug 5 at 8:30
  • @VitalyBelyakov You are welcome! If my answer helped, please mark it as accepted, so others can easily see this has been solved. If the second problem is still present, please add the error message and dat extension details to your question so further investigation is possible. – Markus Slabina Aug 5 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.