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.开发者_如何学Go 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?
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']
精彩评论