cancel
Showing results for 
Search instead for 
Did you mean: 

Question regarding the SIM Guide, dated May 2014

Hi,

 

Just thought I would forward something I saw that struck me as odd.  It may be that I'm misreading things and trying to do something incorrectly, but for what it's worth...

 

On page 29 at the bottom it suggests I can pre-load any of the fields during my payment form request POST using the following syntax:

 

<INPUT TYPE=HIDDEN NAME=”x_name_of_field” VALUE=”value of the field”>

 

When I followed the syntax given, it didn't work.  So I added the ID attribute like this:

 

<INPUT TYPE=HIDDEN NAME=”x_name_of_fieldID=”x_name_of_fieldVALUE=”value of the field”>

 

That worked OK and the payment form was pre-loaded with values I sent.  Am I seeing or doing something incorrectly?

 

Thanks.

 

Best Regards,

Alan

 

wbc
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

This is actually a relatively complicated question. According to html specifications, only the name should have any effect here, but browsers and various toolkits don't always follow those specifications to the letter and it's become a common practice to submit the same value in both the name and id attributes.

 

However, this can actually cause some problems depending on what aspects of our API you are using. Line Items in particular are problematic because our API allows you to send multiple line items each with the same name (x_line_item). There is not a problem when your html follows the specifications and uses only the name attribute, but using the id attribute will cause html validation errors because ids must be unique.

 

As long as you are sending only one value for each input name, then you should be fine setting both the name and id attributes, but it might still be worth looking into why you are experiencing an error when you send only the name. A couple of potential causes would be a toolkit such as .Net potentially overwriting names in certain scenarios, or various ajax toolkits that may incorrectly prioritize the id over the name when constructing the querystring.

View solution in original post

Trevor
Administrator Administrator
Administrator
3 REPLIES 3

This is actually a relatively complicated question. According to html specifications, only the name should have any effect here, but browsers and various toolkits don't always follow those specifications to the letter and it's become a common practice to submit the same value in both the name and id attributes.

 

However, this can actually cause some problems depending on what aspects of our API you are using. Line Items in particular are problematic because our API allows you to send multiple line items each with the same name (x_line_item). There is not a problem when your html follows the specifications and uses only the name attribute, but using the id attribute will cause html validation errors because ids must be unique.

 

As long as you are sending only one value for each input name, then you should be fine setting both the name and id attributes, but it might still be worth looking into why you are experiencing an error when you send only the name. A couple of potential causes would be a toolkit such as .Net potentially overwriting names in certain scenarios, or various ajax toolkits that may incorrectly prioritize the id over the name when constructing the querystring.

Trevor
Administrator Administrator
Administrator

Thanks, Trevor,

 

I am using .NET, but I wouldn't understand how to get around the problem.  Perhaps you could elaborate a little how we get to the bottom of this, given that you are stating that only the name should work.

 

How would I determine this?  Since the API operation is on your end, I don't know how I would determine why it isn't responding unless I send an ID attribute as well.

 

BTW, thanks for the heads up regarding other aspects of the API namely the line item part.  I won't be using that for the time being, but good to know that their could be problems there.

 

Best Regards,

Alan

The first step that I would take would be to look at what the "name" fields are actually set to once the page is rendered in the web browser. If you go to your page just before submitting to Authorize.Net, you should be able to see this in the source code. If the page is particularly complex, you may be best off using a browser developer console to log the network data and see what is being sent. 

 

If you can confirm that the problem is the elements being renamed, then it's most likely a result of using those elements in a code behind. You might want to look at the suggestions in this thread on the ASP.net forums.

Trevor
Administrator Administrator
Administrator