If you are working with MySQL or some other database system,
then your database should deliver a valid id.
For a description have a look in the HowToDos and search for:
Creating a new record with subrecords in MySQL

Best regards
> Hi!
> I have a form that is used to insert some records to a database, and one
> of the fields is a sequence number. I want to increment this number when
> the form is used, unless is the first time it is loaded.
> The form (idea copied from the SmartForms HOWTO) have the name
> "Register", and is something like this:
> <dtml-var standard_html_header>
>   Record inserted.
> </dtml-if>
> <dtml-if my_number>
>   <dtml-call "REQUEST.set('my_number', my_number + 1)">
> <dtml-else>
>   <dtml-call "REQUEST.set('my_number', 1)">
> </dtml-if>
> <form action="Register" method="POST">
> A Field <input name="my_field" value="some value"><br>
> A Number <input name="my_number" value="<dtml-var my_number>"><br>
> <input type="submit" value="OK">
> </form>
> <dtml-var standard_html_footer>
> It work for the first load, but when I press the OK button, I get an
> error message:

Reply via email to