Author Topic: Help? Prepopulating Task Title field  (Read 4394 times)

fernandog

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Help? Prepopulating Task Title field
« on: June 16, 2010, 03:22:27 pm »
Hello,

I'd like to know if anyone can help me with this. Seems pretty simple but I have not been able to do it.

Say I view a task (ie, "clean the house"), I click on "Add subtask".
The form for adding a subtask comes up.

I want the subtask title field to be prepopulated with the parent's task title ("clean the house")

This field is located in application/views/task/task_list.php here:

Code: [Select]
<?php echo text_field("task[title]"null, array('class' => 'title''id' => 'addTaskTitle' $task_list->getId())) ?>
I figured out that this code shows the parent's task title:
Code: [Select]
<?php echo ($task_list->getTitle())?>
So, basically, I want this text field to display the value of $task_list->getTitle()

Anyone?

Thanks!



cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Help? Prepopulating Task Title field
« Reply #1 on: June 22, 2010, 10:30:14 am »
You've already solved it. Haven't you?

fernandog

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Help? Prepopulating Task Title field
« Reply #2 on: June 22, 2010, 11:15:43 am »
Hi Cabeza!

Nope, i tried putting $task_list>getTitle instead of "null" but the form wont work.

Thanks for all your help with this and the other topics!!

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Help? Prepopulating Task Title field
« Reply #3 on: June 22, 2010, 12:00:10 pm »
Just checking ...
do you mean
Code: [Select]
$task_list->getTitle()with parenthesis at the end?

fernandog

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Help? Prepopulating Task Title field
« Reply #4 on: June 22, 2010, 01:51:58 pm »
yes I do...that prints the parent task's title

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Help? Prepopulating Task Title field
« Reply #5 on: June 22, 2010, 02:15:07 pm »
What error do you get while executing the following?

Code: [Select]
<?php 
echo text_field("task[title]"$task_list->getTitle(), array('class' => 'title''id' => 'addTaskTitle' $task_list->getId())) 
?>


Check the log if it's not displaying anything

fernandog

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Help? Prepopulating Task Title field
« Reply #6 on: June 22, 2010, 02:42:17 pm »
As soon as I hit "add subtask" it shows the form for about 2 seconds (and I can see the fields is not prepopulated -btw) and then it jumps to "create new task" view (the one that shows all options including workspace, linked objects, etc) and none of the fields are populated.....

A "workaround" that I have been using is to add a second field right bellow the first one with the following code:

Code: [Select]
<input type="text" name="task[title]" value="<?php echo ($task_list->getTitle()) ?>">

This seems to work fine, as in the second field is prepopulated  with the parents task title, and the subtask can be created successfully.

The bizarre problem is that the original field is still there and I cannot hide it. If I delete it, the form jumps as described. I have resolved to turn the first field into a radio button that doesnt do anything and the form is working OK, but the radio button is there.

Does that make any sense?  ??? :D

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Help? Prepopulating Task Title field
« Reply #7 on: June 22, 2010, 03:02:29 pm »
:S Not really ...

The return of the invocation to add_task in TaskController after you click seems to be redirecting you to the complete task edit screen.

Hope that guides you ...