Welcome Guest, Not a member yet? Register   Sign In
Is it possible to transfer the value of a link into a form.
#1

[eluser]Unknown[/eluser]
Okay, simply enough I'm having a bit of trouble and thought I'd post to see if anyone had any ideas or suggestions.
Basically using the CI calendar function I want to allow users to click any day in order to place the day/date in the date field of a form right beside the calendar.
I know this can be done between forms with javascript, but trying to do it with a regular link seems trickier, so either is there a specific manner I can do this in with a normal link, or how do I cancel out the link so it doesn't actually attempt to load another page.
#2

[eluser]Mirage[/eluser]
Sounds like you're trying to turn a link into a POST request. That requires javascript.

If you want a link that simply selects a different day in the calendar and you want the round-trip to the server simply target the controller/method passing the desired date as a URI parameter and re-render the the view...

Is that what you're looking for?

-m
#3

[eluser]Myles Wakeham[/eluser]
If you are trying to grab a value from a Web Page and have it changed on the browser and then submitted back to PHP for interpretation, you'll need Javascript. A simple 'Onclick' type event can be added to a link that invokes JS to change a form variable, set an action to the form to where you want it submitted to, and then post the form. This is rudimentary DOM/JS functionality and not a topic I think suitable to CI. There should be plenty of resources on the Web with a Google search, or time to hit the local bookstore and crack a JS book on the subject.

Myles




Theme © iAndrew 2016 - Forum software by © MyBB