Welcome Guest, Not a member yet? Register   Sign In
Anyway to get value from checkbox with a link?
#1

[eluser]chobo[/eluser]
I know this sounds kind of dumb, but it seems like a logical thing to be able to do. Can you have a whole bunch of check boxes beside a list of items. A user can check those check boxes and then click a link and the link can "somehow" pass the checked box values to the page the link opens up.

Think of it like a link replacing a button...
#2

[eluser]Michael Wales[/eluser]
Why not just style a button to look like a link?
#3

[eluser]chobo[/eluser]
Ya... I just wish you could use links like that. I was just hoping there was some magic way to do it with ajax or something. Thanks for the suggestion Smile
#4

[eluser]Michael Wales[/eluser]
I mean, you could - it would just be a mess. You'd basically use Javascript to alter the href value of the link each time a box was checked/unchecked. Something like domain.com/controller/method/box1,box2,box6,box7. Your method would then have to parse out segment 3 which would contain the boxes that were checked.

So much easier to just submit it as a form - if you need a permalink, based on the forms data, dump it to a database with a unique ID and write a method to return that record.
#5

[eluser]Sean Murphy[/eluser]
You could just use onClick="form.submit()" in your link. Although, I think, as walesmd said, styling a button would be a better solution.
Code:
<button type="submit" style="background: none;border: 0;margin: 0;padding: 0;"><a href="#">Click Me!</a></button>
At least, I think that will work.




Theme © iAndrew 2016 - Forum software by © MyBB