oasisp
Posts: 48
|
Posted: 03/01/2012, 11:23 AM |
|
I am using a check box list and want to modify the value of {Description}.
i want to have hyperlink on {Description} from database field.
|
|
|
clahti2
Posts: 107
|
Posted: 03/01/2012, 12:56 PM |
|
Quote oasisp:
I am using a check box list and want to modify the value of {Description}.
i want to have hyperlink on {Description} from database field.
Hmmm, this one is a head scratcher, where is the URL coming from? A field in the database? I am toying with this now, but I suspect the solution is going to do something like this:
original
<!-- BEGIN CheckBoxList myopts -->
<input id="recordmyopts_{myopts:optionNumber}" value="{Value}" type="checkbox" name="{myopts_Name}" {Check}><label for="recordmyopts_{myopts:optionNumber}">{Description}</label>
<!-- END CheckBoxList myopts -->
modified
<!-- BEGIN CheckBoxList myopts -->
<input id="recordmyopts_{myopts:optionNumber}" value="{Value}" type="checkbox" name="{myopts_Name}" {Check}><label for="recordmyopts_{myopts:optionNumber}">{Description}</label>
<img id="lnk_{myopts:optionNumber}" name="lnk_{myopts:optionNumber}" src="/images/someimage.png" onclick="alert('checkbox lnk_{myopts:optionNumber} clicked')"><br>
<!-- END CheckBoxList myopts -->
As you can see I added a manual html image link between the end of the label and the closing CCS tag, with an ID that matches the optionNumber. This is not a CCS form control, but a manual HTML control. This gets correctly numbered along side the checkbox, you will have to change the alert() javascript to window.location(something) based on the id of the checkbox selected. This will hopefully get you started, I would be curious to see how this gets solved ultimately. Also the added <br> makes the list vertical instead of horizontal.
/Christian
|
|
|
oasisp
Posts: 48
|
Posted: 03/01/2012, 1:11 PM |
|
yes url field is from same database as well
database table example: id, myopts_Name, Description & URL
<!-- BEGIN CheckBoxList myopts -->
<input id="recordmyopts_{myopts:optionNumber}" value="{Value}" type="checkbox" name="{myopts_Name}" {Check}> <A HREF="{URL}"><label for="recordmyopts_{myopts:optionNumber}">{Description}</label> </A>
<!-- END CheckBoxList myopts -->
|
|
|
clahti2
Posts: 107
|
Posted: 03/01/2012, 3:21 PM |
|
I have working code for you but CCS forum will not allow the post, very frustrating.
|
|
|
clahti2
Posts: 107
|
Posted: 03/01/2012, 3:22 PM |
|
trying to figure out what it doesn't like...
<!-- BEGIN CheckBoxList chkboxgroup -->
<input id="recordchkboxgroup_{chkboxgroup:optionNumber}" value="{Value}" type="checkbox" name="{chkboxgroup_Name}" {Check}><label for="recordchkboxgroup_{chkboxgroup:optionNumber}">{Description}</label>
<img id="lnk_{chkboxgroup:optionNumber}" name="lnk_{chkboxgroup:optionNumber}" src="/images/someimage.png" onclick="OpenMyStuff({chkboxgroup:optionNumber});"><br>
<!-- END CheckBoxList chkboxgroup -->
|
|
|
clahti2
Posts: 107
|
Posted: 03/01/2012, 3:23 PM |
|
and this
function OpenMyStuff(selectedcontrol) {
var chkboxid;
chkboxid = "sensorssensorgroupid_" + selectedcontrol.toString();
alert('the selected value of control' + chkboxid + 'is:' + document.getElementById(chkboxid).value);
}
|
|
|
clahti2
Posts: 107
|
Posted: 03/01/2012, 3:23 PM |
|
and this
window.location('myinfopage.php?id=' + document.getElementById(chkboxid).value);
|
|
|
clahti2
Posts: 107
|
Posted: 03/01/2012, 3:31 PM |
|
hmmm...all that together in the same post is a no-go! Anyway with the above snippets just change the alert to window location, you now have the key field value of the record for each checkbox line so you would do something like the window location function to redirect to a myinfopage which could then DLookup the record key value passed to ultimately get the URL to redirect to.
|
|
|
clahti2
Posts: 107
|
Posted: 03/01/2012, 3:32 PM |
|
ignore the sensorssensorgroupid_ part, I was working this out with a page in a project I am working on now. This should be recordchkboxgroup_
|
|
|