开发者

How to return 2 values from a text link using shadowbox to parent page form

开发者 https://www.devze.com 2023-01-08 12:08 出处:网络
I have a form where i need to put 2 values that will be selected from a shadowbox modal window. the problem im having is it will be a list of probably HUNDREDS of values listed and paginated.

I have a form where i need to put 2 values that will be selected from a shadowbox modal window.

the problem im having is it will be a list of probably HUNDREDS of values listed and paginated.

how can i return 2 values with a sin开发者_Python百科gle click without using forms?

parent page:

<input name="id" type="hidden" value="" />
<input name="data" type="text" readonly="true" />

Shadowbox printout:

<?php
$total = count($_parameters);
for($i = 0; $i < $total;$i++) {
 echo $_parameters[$i] ['id'] . ", " . $_parameters[$i] ['data'] . "<br />";
}

the shadowbox printout indeed needs an href of sorts, i know, where i can have the 2 values, one for the id and another for the data.

the id value have to populate the hidden field, the data value the textbox

i've been banging my head over this for over 4 hours with no luck

based on http://shadowbox-js.com/forum.html#nabble-td4019963|a4806279 it can be done with forms, but that method (sorry im not a javascript expert) my thoughts go to have a function for each result, with a form for each result, which seems ridiculously unreasonable.

sorry maybe my question is really noobish, or maybe foolish, but all help is appreciated.


Using a click function you can return both data. You can use split function to split the data in to (so you get a id and data). You should put every line in div tag or something.

$(".your_list").click(function() { var data = $(this).text().split(",");  });

ok there you have it, data[0] is your id and data[1] is you data.

0

精彩评论

暂无评论...
验证码 换一张
取 消