Hi Everyone
I'm trying to add dynamic elements to a form, I have this strcuture:
Event hasmany Tickets
So an event can have 0 to * tickets. I use this javascript function to add
the tickets to the form:
function AddNewTicket()
{
$('#divTickets').append("<div class=\"divTicket\"> <div
class=\"input text\"><label for=\"Ticket" + currentFields +
"Name\">Name</label><input type=\"text\" id=\"Ticket" + currentFields +
"Name\" maxlength=\"200\" name=\"data[Ticket][" + currentFields +
"][name]\"></div><div class=\"input number\"><label for=\"Ticket" +
currentFields + "Price\">Price</label><input type=\"number\" id=\"Ticket" +
currentFields + "Price\" maxlength=\"11\" step=\"any\"
name=\"data[Ticket][" + currentFields + "][price]\"></div><div
class=\"input number\"><label for=\"Ticket" + currentFields +
"Quantity\">Quantity</label><input type=\"number\" id=\"Ticket" +
currentFields + "Quantity\" name=\"data[Ticket][" + currentFields +
"][quantity]\"></div><div class=\"input textarea\"><label for=\"Ticket" +
currentFields + "Description\">Description</label><textarea id=\"Ticket" +
currentFields + "Description\" rows=\"6\" cols=\"30\" name=\"data[Ticket]["
+ currentFields + "][description]\"></textarea></div><div class=\"input
text\"><label for=\"Ticket" + currentFields + "StartDate\">Start
Date</label><input type=\"text\" id=\"Ticket" + currentFields +
"StartDate\" class=\"datetimepicker\" name=\"data[Ticket][" + currentFields
+ "][start_date]\"></div><div class=\"input text\"><label for=\"Ticket" +
currentFields + "EndDate\">End Date</label><input type=\"text\"
id=\"Ticket" + currentFields + "EndDate\" class=\"datetimepicker\"
name=\"data[Ticket][" + currentFields + "][end_date]\"></div>
</div>");
currentFields++;
return false;
}
And it adds the elements fine but the validation/saving it's not working
for the tickets.
I'm using the 2.1.3 version. Any help is welcome.
Cheers
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php