Accessing form data
Archived from the Xataface Users forum.
gsilvis — Wed Dec 23, 2009 6:21 pm
Can I access the data keyed into a form on the edit page?
In the Edit page I want to add a clickable link after a field (using the function block__after_%field%_widget()) that will send the user to another website to look up information about what he has entered into the field. That html needs what he has keyed in. He hasn’t saved yet so its not in the database.
Can I access the data that has just been typed in?
Thanks
George
shannah — Thu Dec 24, 2009 11:37 am
Yes. You can you javascript.
In general:
- Code: Select all
<script type="text/javascript"> function gotoPage(){ var fieldVal = document.getElementById('my_field').value; window.location.href='http://example.com/index.php?param1='+fieldVal; return false; } </script> <a href="javascript:gotoPage();">Click here</a>
gsilvis — Thu Dec 24, 2009 2:34 pm
Very cool
I changed to window.open to send my query to another window.
And I took the “return false” from the script function so that when I collapsed the window I was sent to I don’t just see the word “false”, but my edit window with the users input still in place.
Thanks!
George