Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 219859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:53:03+00:00 2026-05-11T18:53:03+00:00

** EDIT ** I’m afraid I wasn’t in the right direction – the problem

  • 0

** EDIT **

I’m afraid I wasn’t in the right direction – the problem isn’t what I asked about.
the Javascript works as it should, it’s the PHP that doesn’t show what I want it to
on the first “run” – and I’m stil not sure why.
Sorry for somewhat wasting your time…

**

I have a form that might or might not already contain data in its fields.
If a user reaches the form and he already has some data in the system,
his ID number, for instance, will appear in the ID field – and a JavaScript function running
onLoad will disable the input field and change its style:

<body onload="runFunction()">

the problem is that it seems to run before the PHP does its part,
and only if I refresh the page, the JS function does everything I want it to
(it disables and styles some other form fields that depend on a PHP condition).

Is there a way to have this JS function run AFTER the page was rendered?
I tried running this before closing the page:

<body>
...
...
<script>
runFunction();
</script>
</body>
</html>

but to no avail.

any ideas?
Thanks!

some of the relevant PHP code: [I removed id attributes to make reading easier]

<?php if ($h_phone != '' && $h_phone_pre != '') {  
echo "<td class=\"input\"><input type=\"text\" id=\"new_user_home_tel\" value=\"$h_phone\" size=\"8\" maxlength=\"7\" disabled=\"disabled\" /> -  
<select id=\"new_user_home_tel_pre\" disabled=\"disabled\">  
  <option value=\"$h_phone_pre\" selected=\"selected\"></option>";

     } else {

echo '<td class="input"><input type="text" id="new_user_home_tel" size="8" maxlength="7" /> -  
 <select id="new_user_home_tel_pre">  
   <option value=" " selected="selected"></option>';
    }?>  <option value="02">02</option>
     <option value="03">03</option>
     <option value="04">04</option>
     <option value="08">08</option>
     <option value="09">09</option>
</select> 
</td>   

the Javascript code just changes the style if the field isn’t empty and that works,
but the PHP works only after a refresh.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:53:04+00:00Added an answer on May 11, 2026 at 6:53 pm

    I’m afraid I wasn’t in the right direction – the problem isn’t what I asked about. the Javascript works as it should, it’s the PHP that doesn’t show what I want it to on the first “run” – and I’m stil not sure why. Sorry for somewhat wasting your time…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 122k
  • Answers 122k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Objective-C methods are called selectors, and are represented by the… May 12, 2026 at 12:47 am
  • Editorial Team
    Editorial Team added an answer Two options. Remove the 'Devel' module from your modules directory… May 12, 2026 at 12:47 am
  • Editorial Team
    Editorial Team added an answer Ok, here's the answer - $_SESSION works for authenticated users… May 12, 2026 at 12:47 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Edit: I have solved this by myself. See my answer below I have set
EDIT: I missed a crucial point: .NET 2.0 Consider the case where I have
EDIT: I'm still waiting for more answers. Thanks! In SQL 2000 days, I used
Edit: I am using SqlDataAdapters to fill the data sets. Sorry--I should have been

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.