1

I'm trying to insert a RequestParameter to upsert a Data Extension trough CloudPage after a e-mail activity:

The SubscriberKey is passing, but the INPUT files not. I think could be a relationship with JQUERY in HTML form.

EDIT

Hello guys,

i got it passing the parameter trough javascript. First the ampscript prefill the hidden input (skey) and after javascript pass the parameters for the handler page:

form.addEventListener('submit', function(ev){
  ev.preventDefault();
  validateInputErrors();      
  if (isValid) {
  var Id = document.getElementById('skey').value;
  var fn = document.getElementById('document').value; 
  var dateControl = document.querySelector('input[type="date"]');
  dateControl.value = '2017-06-01';
  console.log(dateControl.value);
  console.log(dateControl.valueAsNumber); 
window.location.href = ('https://domain.com/handlerUAT1?Id='+Id+ "&Document="+fn+ "&Birthday="+dateControl);

} });

// FINAL EDIT //

HTML FORM

              <div class="form-group">
                                <input name="Id" type="hidden" value="%%=v(@Id)=%%">
            
              <label for="">Document *</label>
              <input class="form-control" type="text" name="document" maxlength="11" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);">
          </div>
          <br clear="all">
          <div class="form-group">
              <label for="">Mothers Name *</label>
              <input id="MothersName" class="form-control" type="text" name="MothersName" value="">
          </div>
          <br clear="all">
          <div class="form-group">
              <label for="">birthday*</label>
              <input id="Birthday" class="form-control" type="date" max="" min="" name="birthday" value="">
          </div>
      </fieldset>
      <div class="form-horizontal">
          <input type="submit"  name="submitted" value="send">
%%[ 

var @subKey, @Birthday
set @subKey = RequestParameter("Id")
set @birthday= RequestParameter("birthday")

]%%



HandlerCloudPage (7812)
```lang-ampscript
%%[ 

var @subKey, @birthday
set @subKey = RequestParameter("Id")
set @birthday= RequestParameter("birthday")
set @fecha_registro = Now(1)

UpsertDE("Out-2020",1,"Id",@subKey ,"birthday",@birthday,
"fecha_registro ",@fecha_registro)

]%%

has anyone had a similar problem? The point thats the RequestParameter does not encountered the inputname. I dont understand why

5
  • 1
    I can see a space after the 'birtthday' in the first cloud page – Swati Mishra Oct 16 '20 at 7:55
  • Hello @SwatiMishra. It's not this, i tried :/ – João Oct 16 '20 at 12:44
  • just obvious pointers for starters - the space Swati mentioned is also in the second cloudpage in both "birtthday " and "fecha_registro "; + Since you are consistently misspelling "birtthday" the assumption is that this is intentional and the misspelling is also the case on your form and your data extension? – Jonas Lamberty Oct 16 '20 at 13:00
  • Yes, @JonasLamberty . It's equal in DE. I tried with a literal value and pass with sucess the parameter. So the problem is the RequestParameter that does not pass the 'input name', i'm also trying to understand why could be happen. The form action = <form action="%%=RequestParameter('PAGEURL')=%%" method="post"> – João Oct 16 '20 at 13:06
  • 1
    I do not understand the use of space in the parameter – Swati Mishra Oct 16 '20 at 14:33
1

There are three potential error sources:

a) the form. - Please include your form page's code.

b) your code - which you could remove the spurious spaces from.

c) your DE - information about this can help as well.

Go through it from a to c. To isolate the behavior, simplify everything to text fields first.

a) Are you sending the input from the form correctly? The difference between "_subscriberkey" and "birtthday" is that the latter relies on being sent correctly from form to handler. Reading out "_subscriberKey" is standard cloudpage functionality, independent of the form. Wrong form setup would be consistent with the effect of "_subscriberKey" working but form input not working. So maybe the form doesnt send anything, or incorrectly structured data.

make the birthday field on the form a text field first and see if you can pick data up from it. See also c) so your DE is prepared for text input.

If text works but you need a date picker: Make sure that you understand the way the date picker structures the "value" that it will send. Send it to a text field. Then go to c.

b) looks pretty much ok, typos aside.

c) Do you need "birtthday" to be a date field in the DE?

If yes: Are you sure that your input data collected on the form is in the correct format for a Data Extension "date" field?

You can isolate this:

  1. replace the RequestParameter bit for "birtthday" with:
set @birtthday = NOW()

if that works and can be seen in the DE after submittal, you might have empty value (>>back to a) ) or a formatting error in the "birtthday" value that's coming from your cloudpage.

  1. Make your "birtthday" field a text field and try again.

If reading text input works, check can see the incoming date format and work from there.

2
  • Thanks for attention, Jonas. I will try to do this and let you know if works I send the html form and correct the word 'birthday' in Data Extension, RequestParameter and Input – João Oct 16 '20 at 17:41
  • hello @jonas; I got it with javascript; I edited the case. – João Oct 20 '20 at 14:22

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.