Six Stars

Creating a component need help retrieving a string value

Hello,

 

I am in the process to create a new component. I am able to retrieve all parameters as strings except for a Parameter closed list, which gets pickup as a variable and not a string. 

 

The METHOD parameters is the only CLOSED_LIST parameter. Please see XML below.

Screenshot 2018-05-16 23.35.45.png

 

I used a standard ElementParameterParser.getValue to retrieve the set value.

Screenshot 2018-05-16 23.18.03.png

 

Here I set my string Variable with the value I just retrieved.

Screenshot 2018-05-16 23.18.24.png

As you see, when I try to run it, I get a message that the system cannot resolve the POST variable, but it is not a variable but a value of the httpMethod_<%=cid%> value.

Screenshot 2018-05-16 23.19.45.png

 

When I look at the code, I can see all my other variable were set properly but for myhttpMethod_<%=cid%> variable value. The POST was set without the quotation mark. When I hard code the POST value, than the component works as expected.

 

Screenshot 2018-05-16 23.20.21.png

 

Any help to resolve this would be very much appreciated. 

 

Regards,

Joseph

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Creating a component need help retrieving a string value

I realized that I had to append the quotes as I was reading in the variable. Here is the line I changed that got me the result I was looking for.

 

String method = "\""+ElementParameterParser.getValue(node,"__METHOD__")+"\"";

 

Thank you for your support.

2 REPLIES
Nine Stars

Re: Creating a component need help retrieving a string value

Not sure (not much experience creating components), but while generating the code, it resolves to a var name in stead of a string value, "\"POST\""  escape your quotes.

Why not use default and set it to POST 

Six Stars

Re: Creating a component need help retrieving a string value

I realized that I had to append the quotes as I was reading in the variable. Here is the line I changed that got me the result I was looking for.

 

String method = "\""+ElementParameterParser.getValue(node,"__METHOD__")+"\"";

 

Thank you for your support.