Accessing form data

A place for users and developers of the Xataface to discuss and receive support.

Accessing form data

Postby 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
gsilvis
 
Posts: 20
Joined: Sat Dec 05, 2009 4:52 pm

Postby 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>
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Accessing form data

Postby 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
gsilvis
 
Posts: 20
Joined: Sat Dec 05, 2009 4:52 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved