Link to home
Start Free TrialLog in
Avatar of DCL3
DCL3Flag for United States of America

asked on

Javascript question: What's the difference in these scripts?

I have these two pages and one is functioning properly and the other will not resolve to the preview page.  I am stumped as to why the script (which has alot more question fields on it, I know) is  not working.  Please show me what I am doing wrong or what I have left out. prototype.js preview.html le.worshop.staff.observation.for.html hospital.emergency.contacts.html
preview.html
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Could you please upload the two forms with the script to a test server so we do not have to mix and match just to debug?
Also please be more specific as to what is not working? validation, display, effects?

Did you try loading them into firefox and look in the error console?

Avatar of DCL3

ASKER

ok, this is the one that is working (displaying correctly once you click  on the preview button) correctly..
In other words, the information I enter on this page...
http://www.showmethesite.com/dhec/le.worshop.staff.observation.form.html
is showing up fine and displaying: the form properly on this page..
http://www.showmethesite.com/dhec/preview.html

However, when I try to use the same script (but modified for this page's contents)on this page
http://www.showmethesite.com/dhec/hospitalcontacts/hospital.emergency.contacts.html

It does not display the page nor the populated fields on this page..
http://www.showmethesite.com/dhec/hospitalcontacts/preview.html
Both forms are giving this error every second
Error: element is null
Source File: http://cdn.uservoice.com/javascripts/application_packaged.js?1294188324
Line: 491

Could it be a missing submit button?
Avatar of DCL3

ASKER

well, the preview button at the bottom works with the script and changing it will cause it not to function is what I have experienced.  If you see a better more workable solution then please suggest.  My main issue is that
This page:
http://www.showmethesite.com/dhec/hospitalcontacts/hospital.emergency.contacts.html

It does not display the page nor the populated fields on this page..
http://www.showmethesite.com/dhec/hospitalcontacts/preview.html

You have always been great to help me in the past so whatever suggestion you have I am open to..
When I click preview I get

Error: $("haOCname") is null
Source File: http://www.showmethesite.com/dhec/hospitalcontacts/hospital.emergency.contacts.html
Line: 2228

 <input name="haOCname" type="text" id="haMDname" size="40" />

You need to change to

 <input name="haOCname" type="text" id="haOCname" size="40" />
Avatar of DCL3

ASKER

I am still not getting anything on the preview page.....
What could the issue still be?
Perhaps more of the same. The form is a monster. I'll look in an hour or so
Avatar of DCL3

ASKER

thanks for looking at it...I'll await your reply..
Open the page in Firefox, click the preview and the error console will show you a lot

Error: $("hdlabPCname") is null
Source File: http://www.showmethesite.com/dhec/hospitalcontacts/hospital.emergency.contacts.html
Line: 2322

which means
<input name="hdlabPCname" type="text" id="adminoncall33" size="40" />

is wrong

and while I looked I saw the next field was also wrong:

<input name="hdlabLSOCname" type="text" id="adminoncall33" size="40" />

Ditto

<input name="hdedPECname" type="text" id="adminoncall33" size="40" />
<input name="hdedSECname" type="text" id="adminoncall33" size="40" />

Ditto

<input name="hdmsPECname" type="text" id="adminoncall33" size="40" />
<input name="hdmsOCSname" type="text" id="adminoncall33" size="40" />

and this is not correct either
<input name="\hdmsOCSemail" type="text" id="\hdmsOCSemail" size="40" />

you need to remove the \

and here are more

<input name="hdmsSSCname" type="text" id="adminoncall33" size="40" />
<input name="hdmsTRANSLATEname" type="text" id="adminoncall33" size="40" />

<input name="hdcmrcleCPCname" type="text" id="adminoncall33" size="40" />
<input name="hdcmrcleCNTYPCname" type="text" id="adminoncall33" size="40" />

<input name="hdcmrcleSHERCONname" type="text" id="adminoncall33" size="40" />
<input name="hdcmrcleEODname" type="text" id="adminoncall33" size="40" />

<input name="hdcmrcleOLAWEname" type="text" id="adminoncall33" size="40" />

<input name="hdcmrcCORONERname" type="text" id="adminoncall33" size="40" />

<input name="hdfireVOLFDname" type="text" id="adminoncall33" size="40" />

<input name="hdemscCOUNTYEMSname" type="text" id="adminoncall33" size="40" />
<input name="hdemscCITYEMSname" type="text" id="adminoncall33" size="40" />

<input name="hdemscAMBULANCEname" type="text" id="adminoncall33" size="40" />
<input name="hdemscPRIVAMBULANCEPROVname" type="text" id="adminoncall33" size="40" />

<input name="hdlphcHDname" type="text" id="adminoncall33" size="40" />
<input name="hdlphcPUNHEALTHPREPname" type="text" id="adminoncall33" size="40" />

<input name="hdlphcEPIDDIVISname" type="text" id="adminoncall33" size="40" />
<input name="hdlphcEHname" type="text" id="adminoncall33" size="40" />

<input name="hdsphcCOMMofHEALTHname" type="text" id="adminoncall33" size="40" />
<input name="hdsphcPUBHEALTHPREPARDNESSname" type="text" id="adminoncall33" size="40" />

<input name="hdsphcEPIDDIVname" type="text" id="adminoncall33" size="40" />
<input name="hdsphcENVIROHEALTHname" type="text" id="adminoncall33" size="40" />

<input name="hdempcCOUNTYname" type="text" id="adminoncall33" size="40" />
<input name="hdempcCITYname" type="text" id="adminoncall33" size="40" />

<input name="hdempcSTATEname" type="text" id="adminoncall33" size="40" />
<input name="hdempcOTHERCONname" type="text" id="adminoncall33" size="40" />

<input name="hdahcHOSPITALname" type="text" id="adminoncall33" size="40" />
<input name="hdahcEROOM1name" type="text" id="adminoncall33" size="40" />

<input name="hdahcHOSPITAL2name" type="text" id="adminoncall33" size="40" />
<input name="hdahcEROOM2name" type="text" id="adminoncall33" size="40" />

<input name="hdahcHOSPITAL3name" type="text" id="adminoncall33" size="40" />
<input name="hdahcEROOM3name" type="text" id="adminoncall33" size="40" />


I think there is a cut and paste issue here, no?
Avatar of DCL3

ASKER

Ok, file id have been corrected as well as the \ error...still no display on the preview page.
Avatar of DCL3

ASKER

I just open the page in Firefox and no error but no display either..it just says my message "Please wait whiole page is loading..." But it should load instantly with the data.
I still see
 <input name="haOCname" type="text" id="haMDname" size="40" />
I also found
mywin.document.getElementById('preview_hdmsOCSpage').innerHTML = $("hdmsOCSpage").value;
which should be
mywin.document.getElementById('preview_hdmsOCSpager').innerHTML = $("hdmsOCSpager").value;
Avatar of DCL3

ASKER

ok, thanks I fixed that one..what else do you see?
and
mywin.document.getElementById('preview_hdmsTRANSLATEcell').innerHTML = $("preview_hdmsTRANSLATEcell").value;

which should be
mywin.document.getElementById('preview_hdmsTRANSLATEcell').innerHTML = $("hdmsTRANSLATEcell").value;
NOW it works!
So it was not really code issue, just a data-entry quality control issue
Avatar of DCL3

ASKER

Ok, I cleaned up all the errors and it is NOW displaying!! Yea!!!!!!!!!  All I need to know is how I get it to preview in the same format (colored tables and rows..so it doesn't just display on a white form) as the form they filled it out on.  I just don't wanna screw things up at this point.
start by fixing your html

it is to be mildly said DISGUSTING!

If I format it, you can see how bad it is:

<tr>
  <td valign="top" nowrap="nowrap">
    <div align="right">
      <span class="style13">
        <span class="style12">Office:&nbsp;&nbsp;  &nbsp;
           <span id="preview_haEMoffice">
    </div>
  </td>
  <td valign="top" nowrap="nowrap">
    <div align="right">
      <span class="style13">
        <span class="style12">Office:&nbsp;&nbsp;  &nbsp;
            <span id="preview_haSOoffice">
    </div>
  </td>
</tr>

VERY invalid and amazing it shows anything

How about

<tr>
  <td valign="top" nowrap="nowrap" class="style13">
        <span class="style12">Office:&nbsp;&nbsp;  &nbsp;</span>
        <span id="preview_haEMoffice"></span>
  </td>
  <td valign="top" nowrap="nowrap" align="right" class="style13">
        <span class="style12">Office:&nbsp;&nbsp;  &nbsp;</span>
        <span id="preview_haSOoffice"></span>
  </td>
</tr>



???

Why not just copy the input form, but make the fields readonly and borderless
Avatar of DCL3

ASKER

Doesn't work to do that b/c the preview need the field to be specifically this format in order to read correctly <span id="preview_haEMname">
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DCL3

ASKER

ok, great! It works awesome!! You are the best man!! I always appreciate you prompt accurate help!!
Avatar of DCL3

ASKER

mplungjan is the BEST!!
:) Happy New year