This has got me in a pickle, though I'm sure it's probably fairly easy.

I need to get the hash value from the parent window uri, and insert this into the set_value() function. Obviously I can't get a hash with PHP, so it has to be javascript.

parent.location.hash

works but I've no idea how to get it into set_value().

The following is the code I'm working with (obviously wrong but you get the idea):

<label for="appt_start">Start Time</label>
<?php echo form_error('appt_start'); ?>
<br />
<input id="appt_start" type="text" name="appt_start" maxlength="12" 
value="<?php $time = "<script>document.write('parent.location.hash');
</script>"; set_value('appt_start', $time) ;?>" />

Thanks!

Comments

Sorry for the delay, and thanks for the replies. The form is being pulled into the page via ajax (jquery) so i was having trouble with the Captain Tokyo's answer, not sure why entirely. The dark horse has won this one, Tpae (at the bottom of the answers), so thank you for that!

Written by Robimp

Accepted Answer

You can use jQuery to set it to an input:

$('#appt_start').val(parent.location.hash);
Written by tpae
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki