Home/Support/Support Forum/rabbitweb structure variables
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

rabbitweb structure variables

0 votes
Hello, I am unable to update variables in a structure format as follows:

struct body
{
double InputValue;
double SetPoint;
double Proportion;
double Integral;
double Derivative;
}
struct body PID[SAMPLE_CHANNELS];
#web PID

Using :

FORM ACTION="/A/html/index1.htm" METHOD="POST">
<INPUT TYPE="text" NAME="PID[0].SetPoint" SIZE=6 VALUE="<?z printf("%.1f", $PID[$A].SetPoint) ?>">
<INPUT TYPE="submit" VALUE="Apply">
</form>

Could someone please explain why this does not work. The variables display fine in the webpage but never update.

Thanks,
Tim
asked Oct 7, 2014 in Rabbit by tmies New to the Community (2 points)

Please log in or register to answer this question.

2 Answers

0 votes
 
Best answer
Take a look at samples\tcpip\rabbitweb\structures.c and the accompanying html page. This shows how to implement structures with RabbitWeb.
answered Oct 7, 2014 by trooper2 Veteran of the Digi Community (589 points)
selected Oct 7, 2014 by tmies
Thanks for the response.  I looked over those examples last night and understand.  I think the problem lies when I created the array of the structure.  If I revert to a single structure, it works.
0 votes
When All Else Fails.... Keep Reading :) :)

For the value to be updateable, th
e NAME field must be the name of
the variable. Otherwise, when the
form is submitted, the web server will not know where to
apply the new value. This is not true of arrays.
When referencing arrays the name must differ some
what from the C name because the ‘[‘ and ‘]’ symbols
are not valid in the NAME parameter of the INPUT tag due to limitations in HTTP.
The
varname()
function must be used to make the
variable name safe for transmission.
NAME=”<?z varname($foo[3]) ?>”
That is,
varname()
automatically encodes the variable name correctly.
answered Oct 7, 2014 by tmies New to the Community (2 points)
...