Reputation: 383
Okay, so I've gotten this far in modifying the jQueryUI dialog widget. I'm using it as a messaging service for members. What I've done so far is for the widget to carry over values of both the Real Name and the username of the recipient. The only thing left to do is to carry over the value of the userid in a kind of thing. You can all have a look at the jsfiddle. http://jsfiddle.net/pzByS/
[EDIT] I fixed the jsfiddle. The usernames are links to the profile. It would say,
<td class="realname">John Smith</td>
<td class="username"><a href=profile.php?uid=123>johnsmith</a></td>
<td><a href="#" class="opener">Send Message</a></td>
which will differ for every member. How should go in terms of passing the uid value to a hidden input value in the form for the dialog widget?
Upvotes: 0
Views: 156
Reputation: 906
You will need to reference the hidden form element with your other placeholders .
//store reference to placeholders
$realname = $('#realname'),
$username = $('#username'),
$uid = $('input[name=uid]');
And then inside the click handler; match the user id from the query string of the link inside the username element as such.
$uid.attr('value',$row.find('td.username a').attr('href').match(/\?uid=(\d+)/)[1]);
I've tested this in the fiddle and it will populate the hidden input with the user's id as per your requirements.
Ideally you should extract the user id from the links query string separately and do some sanity checking on it before attempting to populate your form element with it, but this should be enough to get you going.
Upvotes: 1