Forum OpenACS Development: ad_form newbee Question

Collapse
Posted by Cesareo Garci­a Rodicio on
Hi!

I'm learning how to use ad_form. It seems a bit complicated for me. I know ad_form is better for use with bd queries but I'm trying to use it as normal form.

So, this is the ad_form code:
" ...

ad_form -name ejemplo_form -method GET -action "http://voo2do.com/api/saveTask"; -form {

{taskdesc:text(text)
{label "Tarea"}
{html {size 35} maxlength 255}
}

{projName:text(select)
{label "Proyecto"}
{options $project_names}
}

{priority:text(select)
{label "Prioridad"}
{options $priority_options}
}
{estCurr:text(select)
{label "Estimacion"}
{options $estimation_options}
}
}

ad_form -extend -name ejemplo_form -form {

{submit:text(submit)
{label "Crear"}
}
}

... "

The form works, call the Action URL but it only use the first field (taskdesc). The 3-others fields appears to not be set.

What am I missing? I checked ad_form API, some code (cal-item-new) but I couldn't make it work. GET method only includes first field

Thanks in advance

Collapse
Posted by Ryan Gallimore on
Not entirely certain what the problem is. But check out this quick sheet for help: http://home.galileo.edu/~miel/openACS/pdf/ad-form-quick-ref.pdf
Collapse
Posted by Cesareo Garci­a Rodicio on
Hi!

Yes, I have that quick sheet and I think I put everything. the problem is that it seems to be that the form only send one field and not four as I expect.

Thanks
Cesáreo

Collapse
Posted by Cesareo Garci­a Rodicio on
Finally it was a very silly error 😊 I did read a lot of documentation, problem was with select options.

This field has to be a list of dooble list, for example:

set priority_options { "1" "2" "2" } is bad but ...
set priority_options { {"1" "1"} {"2" "2"} {"3" "3"} } is good.

So, I had to put label AND value. Now, it works.