0

i have a parent page that calls a sub page in a div.

the parent page has a text box

<input name="txtTicketNo" placeholder="Ticket #"  type="text" value="" class="textbox" readonly="readonly" id="txtTicketNo">

when the child page is called it queries the DB and gets the new record ID which lets says is 1271. so in the child page my code piece looks like this.

<input type="hidden" name="sub_tIDi" id="sub_tIDi" value="<%=oRs(0)%>">

Now i want this 1271 to be written into txtTicketNo in the parent page.

This is what i have tried.

var stID;
stID = document.getElementById('sub_tIDi');
opener.document.NewTicket.txtTicketNo.value = stID.value;

the code runs without error, but there is no value in the text box of the parent page.

appreciate your help.

Thanks

Vinod
  • 130
  • 1
  • 12
  • When you say sub page do you mean in an ` – user692942 May 07 '14 at 12:37
  • no iFrame i have just
    – Vinod May 07 '14 at 12:54
  • A `
    ` in the page is just another element the fact you use it like a popup doesn't mean it will behave like one `opener` will not work here. Just give your `
    ` an `id` then use `getElementById()` to reference it. The fact you talk about *"parent page"* and *"sub page*" is misleading.
    – user692942 May 07 '14 at 13:00
  • Sorry notice your using [tag:jquery] so try something like this `$("#divid").find("input[name=sub_tIDi]").val();`. – user692942 May 07 '14 at 13:02
  • well i tried with removing the opener word and just used document.NewTicket.txtTicketNo.value = stID.value; and no good. – Vinod May 07 '14 at 13:06
  • If you don't want to use [tag:jquery] and your `sub_tIDi` is the only element with that `name` in the page you should be able to use `document.getElementsByName("sub_tIDi")[0].value`. – user692942 May 07 '14 at 13:15
  • the sub-Page("that is the page that gets AJAX called") does not have any
    but has a table with id=ShowDataTable
    – Vinod May 07 '14 at 13:16

0 Answers0