0

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?

1
  • 1
    Can you please describe again what is the problem or what do you want to get. Commented Nov 21, 2011 at 7:14

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.