Does not work.
Not sure, but there are 2 options:
- I'm doing it wrong somewhere, usually the real cause. I'll give my php 
code below
- There is an iUI-caused problem. It seems that when javascript is executed 
in the external file, this is NOT in the current DOM, hence iUI does not 
know howto to goback in history; once this has run (with no tangible 
effect!), THEN the DOM is updated with the javascript text
 
My php code, called by a submit form

<?php
session_start();
foreach ($_POST as $index=>$value) { $_SESSION[$index]=$value; };
$xx=date("hms"); 
?><div id='<?php echo $xx; ?>'>
<script type="application/x-javascript" id='<?php echo $xx; ?>'> 
iui.showPageById('etatVehicule');
</script>
</div>

 Note that if the <script> is not whithin a <div>... the js code is 
visible...
 
Once my code has run, the bottom of the DOM is changed to:
 

<div id="preloader"></div><div selected="true" style="left: 0%;" 
id="100300"><script type="application/x-javascript"> 
iui.showPageById('etatVehicule');</script></div></body></html>

(Rendering by Web Developer in Firefox, Chrome gives a cosmetically different 
code)

 

Another track I had considered, but where I have failed,would be that instead 
of simply submitting the form thru a action="xxx.php" 

(which would include the javascript backgoing) I would include the javascript 
backgoing code in the action itself, with something

like action="javascript:form.submit();iui.showPageById('etatVehicule');" but I 
probably missed something. What would you suggest?

 
 
Le lundi 26 mars 2012 09:16:34 UTC+2, Remi Grumeau a écrit :

>  
> Le 25 mars 2012 à 17:17, Fibo a écrit :
>  
>
> Hi Remi,
>  
> Thx for your answer.
> There is one main difference with what I want to achieve. How would you 
> change your form.php so that if all is Ok, it directly returns to #index 
> without needing any click?
>  
>
>  
> Well, that wouldn't be a feature iUI provides out-of-the-box so i don't 
> think so.
> As a quick/crappy solution, i would ask PHP to output
>  
> <script>iui.showPageById('index')</script>
>  
> if your first screen ID value is "index".
> That shows a sliding back animation to "index" since it's part of the 
> history array, but doesn't goes back in browser history array. So if user 
> press the browser back button, he/she will be back to the form screen.
>  
> To avoid that, i use to do a " history.go(-(history.length-1)) ".
> But that would mean you are sure your user will always open your project 
> in a new window or from a direct URL.
> Otherwise, if he/she comes from Google, search / your homescreen / page B 
> / form, this would lead him/her back to Google. 
>  
> Sadly, no easy "two lines of code" magical trick here : (
> I guess a parameter to iui.goBack() function to archive that wouldn't be a 
> bad idea...
>  
>
> Small question: is the href really needed in <a href="#" type="submit" 
> class="whiteButton">Submit form</a> ?
>  
>
>  
> Nope, you can even use javascript:; to be sure nothing gonna.
>  
>
>  
> Le vendredi 23 mars 2012 19:58:07 UTC+1, Remi Grumeau a écrit :
>
>> Hi Fibo!
>>  
>> Please check 
>> http://we-are-gurus.com/​labs/iui/sandbox/php-form/<http://we-are-gurus.com/labs/iui/sandbox/php-form/>and
>>  tell me if it's what you're trying to do (more or less)
>> index.php has a list + a form.
>> form.php deals with datas and renders an iUI screen based on what you 
>> have submitted.
>> (leave blank to see error panel)
>>  
>> This is what i have in index.php
>>  
>> * <form id="form" title="My form" method="POST" action="form.php" 
>> name="myform" class="panel">*
>>  
>> * <h2>My form</h2>*
>>  
>> * <fieldset>*
>>  
>> * <div class="row">*
>> * <label id="text">First name</label>*
>> * <input type="text" name="firstname" placeholder="Your firstname">*
>> * </div>*
>>  
>> * <div class="row">*
>> * <label id="text">Last name</label>*
>> * <input type="text" name="lastname" placeholder="Your lastname">*
>> * </div>*
>>  
>> * <div class="row">*
>> * <label>Select a fruit</label>*
>> * <select name="fruit" size="1">*
>> * <option value="value1">Apple</option>*
>> * <option value="value2">Banana</option>*
>> * <option value="value3">Pineapple</​option>*
>> * <option value="value3">Strawberry</​option>*
>> * </select>*
>> * </div>*
>>  
>> * <div class="row">*
>> * <label>Number of fruits</label>*
>> * <select name="fruit_num" size="1">*
>> * <?php for($i=1;$i<10;$i++) { ?>*
>> * <option value="<?php echo $i ?>"><?php echo $i ?></option>*
>> * <?php } ?>*
>> * </select>*
>> * </div>*
>>  
>> * </fieldset>*
>>  
>> * <a href="#" type="submit" class="whiteButton">Submit form</a>*
>>  
>> * </form>*
>>  
>>  
>> And this is what form.php looks like:
>>  
>> *<?php*
>> *$num = intval($_POST['fruit_num']);*
>> *?><div id="result" title="Result" class="panel">*
>> * <h2>Form result</h2>*
>> * <fieldset>*
>> * <?php*
>> * if(!empty($_POST['firstname']) && !empty($_POST['lastname']))*
>> * { ?>*
>> * <div class="row" style="text-align: left">*
>> * <p>*
>> * Welcome <?php echo $_POST['firstname'].' '.$_POST['lastname'] ?>!*
>> * </p>*
>> * </div>*
>> * <div class="row" style="text-align: left">*
>> * <p>*
>> * You asked for <?php *
>> * if($num<=1)*
>> * echo $num.' '.$_POST['fruit'];*
>> * else*
>> * echo $num.' '.$_POST['fruit'].'s';*
>> * ?>*
>> * </p>*
>> * </div>*
>> * <?php } else { ?>*
>> * <div class="row" style="text-align: left">*
>> * <p>*
>> * Please enter your firstname & lastname*
>> * </p>*
>> * </div>*
>> * <?php } ?>*
>> * </fieldset>*
>> *
>>  
>> *
>>  
>> * <a href="javascript:history.go(-​1)" class="grayButton">Go back</a>*
>> *
>>  
>> *
>>  
>> *</div>*
>>  
>>  
>> Hope this is gonna help you in any way, and keep us posted if you're good 
>> now (or not)
>>  
>> Remi
>>  
>>  
>>  
>> On Fri, Mar 23, 2012 at 3:32 PM, Fibo <[email protected]> wrote:
>>  
>>
>>> Hi Sean,
>>>  
>>> Still no help.
>>>  
>>> What I am trying to do:
>>> - in my page, main "screen" A goes to form B. This one is defined with 
>>> action: php page C, method post
>>> - I am submittig the form wit a href submit
>>> - C.php does correctly its data-handling part, and its html code is 
>>> pasted fine at the end of my page
>>> - in fact I want this to go autoimatically to main screen A... and I am 
>>> not sure how I should handle that
>>>  
>>> Something I have done but which does not work: have an html code 
>>> generated by C.php with something like
>>> <div id="<?php echo date("Hms"); /* handles multiple calls*/ ?>" >
>>>   <script type="application/x-​javascrript">
>>>       // library iui/jit-loader is loaded in main page
>>>       iui.showPageById('pageA'); // no # here
>>>    </script>
>>> </div>
>>>  
>>> Since it is enclosed with <div>s, the code is present in the result 
>>> page... but I just get the toolbar and a lower level blank page (oolbar 
>>> button points to screen B
>>>  
>>> Obviously I'm doing something wrong, but I have made several attempts 
>>> without finding the right way, help welcome!
>>>  
>>>  
>>>  
>>>  
>>> Le mercredi 14 mars 2012 10:26:32 UTC+1, Sean Gilligan a écrit :
>>>
>>>> On 3/9/12 2:26 AM, Fibo wrote:
>>>> > I have some troubles understanding how to use *iui.ajax* or 
>>>> > *iui.showPageByHref, *at least from page 
>>>> > http://www.iui-js.org/​​documentation/0.50/iui-​​documentation.html<http://www.iui-js.org/documentation/0.50/iui-documentation.html>
>>>>
>>>> Sorry nobody has helped you yet.  Have you solved your problem?  Let me 
>>>> know where you're at and I'll try to help you.
>>>>
>>>> -- Sean
>>>>  
>>>>  
>>>>  
>>>>  
>>>>  
>>>>
>>>  
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "iPhoneWebDev" group.
>>>  
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/​msg/iphonewebdev/-/2qkdxd-​jDCgJ<https://groups.google.com/d/msg/iphonewebdev/-/2qkdxd-jDCgJ>
>>> .
>>>  To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> iphonewebdev+unsubscribe@​googlegroups.com<iphonewebdev%[email protected]>
>>> .
>>> For more options, visit this group at 
>>> http://groups.google.com/​group/iphonewebdev?hl=en<http://groups.google.com/group/iphonewebdev?hl=en>
>>> .
>>>  
>>>
>>  
>>
>  
> -- 
> You received this message because you are subscribed to the Google Groups 
> "iPhoneWebDev" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/iphonewebdev/-/iijRTKoJjUgJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/iphonewebdev?hl=en.
>  
>
>  
>
Le lundi 26 mars 2012 09:16:34 UTC+2, Remi Grumeau a écrit :

>  
> Le 25 mars 2012 à 17:17, Fibo a écrit :
>  
>
> Hi Remi,
>  
> Thx for your answer.
> There is one main difference with what I want to achieve. How would you 
> change your form.php so that if all is Ok, it directly returns to #index 
> without needing any click?
>  
>
>  
> Well, that wouldn't be a feature iUI provides out-of-the-box so i don't 
> think so.
> As a quick/crappy solution, i would ask PHP to output
>  
> <script>iui.showPageById('index')</script>
>  
> if your first screen ID value is "index".
> That shows a sliding back animation to "index" since it's part of the 
> history array, but doesn't goes back in browser history array. So if user 
> press the browser back button, he/she will be back to the form screen.
>  
> To avoid that, i use to do a " history.go(-(history.length-1)) ".
> But that would mean you are sure your user will always open your project 
> in a new window or from a direct URL.
> Otherwise, if he/she comes from Google, search / your homescreen / page B 
> / form, this would lead him/her back to Google. 
>  
> Sadly, no easy "two lines of code" magical trick here : (
> I guess a parameter to iui.goBack() function to archive that wouldn't be a 
> bad idea...
>  
>
> Small question: is the href really needed in <a href="#" type="submit" 
> class="whiteButton">Submit form</a> ?
>  
>
>  
> Nope, you can even use javascript:; to be sure nothing gonna.
>  
>
>  
> Le vendredi 23 mars 2012 19:58:07 UTC+1, Remi Grumeau a écrit :
>
>> Hi Fibo!
>>  
>> Please check 
>> http://we-are-gurus.com/​labs/iui/sandbox/php-form/<http://we-are-gurus.com/labs/iui/sandbox/php-form/>and
>>  tell me if it's what you're trying to do (more or less)
>> index.php has a list + a form.
>> form.php deals with datas and renders an iUI screen based on what you 
>> have submitted.
>> (leave blank to see error panel)
>>  
>> This is what i have in index.php
>>  
>> * <form id="form" title="My form" method="POST" action="form.php" 
>> name="myform" class="panel">*
>>  
>> * <h2>My form</h2>*
>>  
>> * <fieldset>*
>>  
>> * <div class="row">*
>> * <label id="text">First name</label>*
>> * <input type="text" name="firstname" placeholder="Your firstname">*
>> * </div>*
>>  
>> * <div class="row">*
>> * <label id="text">Last name</label>*
>> * <input type="text" name="lastname" placeholder="Your lastname">*
>> * </div>*
>>  
>> * <div class="row">*
>> * <label>Select a fruit</label>*
>> * <select name="fruit" size="1">*
>> * <option value="value1">Apple</option>*
>> * <option value="value2">Banana</option>*
>> * <option value="value3">Pineapple</​option>*
>> * <option value="value3">Strawberry</​option>*
>> * </select>*
>> * </div>*
>>  
>> * <div class="row">*
>> * <label>Number of fruits</label>*
>> * <select name="fruit_num" size="1">*
>> * <?php for($i=1;$i<10;$i++) { ?>*
>> * <option value="<?php echo $i ?>"><?php echo $i ?></option>*
>> * <?php } ?>*
>> * </select>*
>> * </div>*
>>  
>> * </fieldset>*
>>  
>> * <a href="#" type="submit" class="whiteButton">Submit form</a>*
>>  
>> * </form>*
>>  
>>  
>> And this is what form.php looks like:
>>  
>> *<?php*
>> *$num = intval($_POST['fruit_num']);*
>> *?><div id="result" title="Result" class="panel">*
>> * <h2>Form result</h2>*
>> * <fieldset>*
>> * <?php*
>> * if(!empty($_POST['firstname']) && !empty($_POST['lastname']))*
>> * { ?>*
>> * <div class="row" style="text-align: left">*
>> * <p>*
>> * Welcome <?php echo $_POST['firstname'].' '.$_POST['lastname'] ?>!*
>> * </p>*
>> * </div>*
>> * <div class="row" style="text-align: left">*
>> * <p>*
>> * You asked for <?php *
>> * if($num<=1)*
>> * echo $num.' '.$_POST['fruit'];*
>> * else*
>> * echo $num.' '.$_POST['fruit'].'s';*
>> * ?>*
>> * </p>*
>> * </div>*
>> * <?php } else { ?>*
>> * <div class="row" style="text-align: left">*
>> * <p>*
>> * Please enter your firstname & lastname*
>> * </p>*
>> * </div>*
>> * <?php } ?>*
>> * </fieldset>*
>> *
>>  
>> *
>>  
>> * <a href="javascript:history.go(-​1)" class="grayButton">Go back</a>*
>> *
>>  
>> *
>>  
>> *</div>*
>>  
>>  
>> Hope this is gonna help you in any way, and keep us posted if you're good 
>> now (or not)
>>  
>> Remi
>>  
>>  
>>  
>> On Fri, Mar 23, 2012 at 3:32 PM, Fibo <[email protected]> wrote:
>>  
>>
>>> Hi Sean,
>>>  
>>> Still no help.
>>>  
>>> What I am trying to do:
>>> - in my page, main "screen" A goes to form B. This one is defined with 
>>> action: php page C, method post
>>> - I am submittig the form wit a href submit
>>> - C.php does correctly its data-handling part, and its html code is 
>>> pasted fine at the end of my page
>>> - in fact I want this to go autoimatically to main screen A... and I am 
>>> not sure how I should handle that
>>>  
>>> Something I have done but which does not work: have an html code 
>>> generated by C.php with something like
>>> <div id="<?php echo date("Hms"); /* handles multiple calls*/ ?>" >
>>>   <script type="application/x-​javascrript">
>>>       // library iui/jit-loader is loaded in main page
>>>       iui.showPageById('pageA'); // no # here
>>>    </script>
>>> </div>
>>>  
>>> Since it is enclosed with <div>s, the code is present in the result 
>>> page... but I just get the toolbar and a lower level blank page (oolbar 
>>> button points to screen B
>>>  
>>> Obviously I'm doing something wrong, but I have made several attempts 
>>> without finding the right way, help welcome!
>>>  
>>>  
>>>  
>>>  
>>> Le mercredi 14 mars 2012 10:26:32 UTC+1, Sean Gilligan a écrit :
>>>
>>>> On 3/9/12 2:26 AM, Fibo wrote:
>>>> > I have some troubles understanding how to use *iui.ajax* or 
>>>> > *iui.showPageByHref, *at least from page 
>>>> > http://www.iui-js.org/​​documentation/0.50/iui-​​documentation.html<http://www.iui-js.org/documentation/0.50/iui-documentation.html>
>>>>
>>>> Sorry nobody has helped you yet.  Have you solved your problem?  Let me 
>>>> know where you're at and I'll try to help you.
>>>>
>>>> -- Sean
>>>>  
>>>>  
>>>>  
>>>>  
>>>>  
>>>>
>>>  
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "iPhoneWebDev" group.
>>>  
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/​msg/iphonewebdev/-/2qkdxd-​jDCgJ<https://groups.google.com/d/msg/iphonewebdev/-/2qkdxd-jDCgJ>
>>> .
>>>  To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> iphonewebdev+unsubscribe@​googlegroups.com<iphonewebdev%[email protected]>
>>> .
>>> For more options, visit this group at 
>>> http://groups.google.com/​group/iphonewebdev?hl=en<http://groups.google.com/group/iphonewebdev?hl=en>
>>> .
>>>  
>>>
>>  
>>
>  
> -- 
> You received this message because you are subscribed to the Google Groups 
> "iPhoneWebDev" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/iphonewebdev/-/iijRTKoJjUgJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/iphonewebdev?hl=en.
>  
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/iphonewebdev/-/OvGKONZuywYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to