Jump to content

Text box control id not showing up!


nd3_2000

Recommended Posts

Hi guys

 

am having a real problem right now, I need to pass a calander control to another page and I cant seem to get it to read the ID of the text box the value is being placed into.....

 

Here is the code

 

 

<td colspan="2" align="left"><input name="Datelogged" type="text"value ="Click Select" size="15" id="Datelogged" />

        <a href="#"

  name="anchor1" class="style1" id="anchor1"

  onclick="cal.select (document.forms[0].Datelogged,'anchor1','yyyy-MM-dd');  return false;">select</a></td>

    </tr>

 

<a href="CompleteProof.php?JobNumber=<?php  echo $JobNo; ?>&ProofDate=<?php  echo DateLogged; ?>"></BR>[Complete Proof]</a></BR></BR></BR>

 

 

All I keep getting is this, its just passing through the word Datelogged NOT the date value that is in the text box

 

 

 

http://www.xxxxxxxxx.co.uk/CompleteProof.php?JobNumber=PFAug25&ProofDate=DateLogged

Link to comment
Share on other sites

Well, first, DateLogged isn't a proper PHP variable.  It's a string literal, which is why it's being echoed as-is.  Also, it looks like you're confusing the capabilities/uses of PHP and JavaScript.

 

What it looks like you're trying to do is pass an element's value in a query string.  PHP cannot obtain this value (at least, not easily).  It doesn't work like JavaScript where it automatically keeps a representation of the HTML document that you can directly reference.  So, you'll need to use JavaScript in order to fill in the rest.

 

I suggest creating an event handler for a button's onclick event.  You can pass into it the $JobNo value, and obtain the DateLogged value all at the same time:

 

function processClick(jobNo){
   window.location = "CompleteProof.php?JobNumber=" + jobNo + "&ProofDate=" + document.getElementById('DateLogged').value;
}

...

<button type="button" onclick="processClick(<?php echo $JobNo; ?>)">[Complete Proof]</button>

 

This should give you something to start with.

Link to comment
Share on other sites

Hi

thanks for your advice with that, I kind of understand what you are saying and realised it was to do with the calanders value not being passed, apologies as Im pretty new to this!!!

 

I placed the code in and when runnign it, it gives me an error like this on the button click

 

"GPAUG20 is undefined"   

 

when it tries to send the value of the jobNo through!

 

Any ideas? as have no idea of the solution of this!

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.