tags:

views:

66

answers:

1

HI I am new to cakephp so any help would be grateful. I have created a form and with one of the fields when the user has filled in checks to see it it already exists and offers other suggestions. I have used the Ajax observerField method to do this. I want the user to be able to click on the suggested names(radioboxes) and then it update the field in the other form. What is the best way to achieve this in cakephp?

A: 

If it was me, I would create a form field

echo $form->input('otherfield');

Then use javascript to catch the click on the suggested radio, and copy the value into that field.

In jQuery,

$('#suggestions input[type=radio]').click(function(){
  $('#otherfield').val() = $(this).val();
});

Then when the form is submitted you will have it in,

$this->data['Model']['otherfield']
DavidYell
Thanks for pushing me in the right direction